dispose() methods should clear their smart pointers

especiall the ref-counted ones

Change-Id: Ib3bb029043b1b923010ef4a47bfc377e1f569da7
Reviewed-on: https://gerrit.libreoffice.org/76102
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-07-22 11:58:43 +02:00
parent 8f98a7c4e5
commit b71e02dd5b
10 changed files with 12 additions and 0 deletions

View File

@@ -172,6 +172,7 @@ namespace comphelper
{ {
m_xInner->removeEventListener( this ); m_xInner->removeEventListener( this );
m_xInner->dispose(); m_xInner->dispose();
m_xInner.clear();
} }
} }

View File

@@ -226,6 +226,7 @@ void OAppDetailPageHelper::dispose()
Reference< ::util::XCloseable> xCloseable(m_xFrame,UNO_QUERY); Reference< ::util::XCloseable> xCloseable(m_xFrame,UNO_QUERY);
if ( xCloseable.is() ) if ( xCloseable.is() )
xCloseable->close(true); xCloseable->close(true);
m_xFrame.clear();
} }
catch(const Exception&) catch(const Exception&)
{ {

View File

@@ -694,6 +694,7 @@ void SbaGridControl::dispose()
{ {
if (m_nAsyncDropEvent) if (m_nAsyncDropEvent)
Application::RemoveUserEvent(m_nAsyncDropEvent); Application::RemoveUserEvent(m_nAsyncDropEvent);
m_nAsyncDropEvent = nullptr;
FmGridControl::dispose(); FmGridControl::dispose();
} }

View File

@@ -118,9 +118,11 @@ void OReportSection::dispose()
m_pPage = nullptr; m_pPage = nullptr;
if ( m_pMulti.is() ) if ( m_pMulti.is() )
m_pMulti->dispose(); m_pMulti->dispose();
m_pMulti.clear();
if ( m_pReportListener.is() ) if ( m_pReportListener.is() )
m_pReportListener->dispose(); m_pReportListener->dispose();
m_pReportListener.clear();
m_pFunc.reset(); m_pFunc.reset();
{ {

View File

@@ -108,8 +108,10 @@ void OSectionWindow::dispose()
{ {
if ( m_pSectionMulti.is() ) if ( m_pSectionMulti.is() )
m_pSectionMulti->dispose(); m_pSectionMulti->dispose();
m_pSectionMulti.clear();
if ( m_pGroupMulti.is() ) if ( m_pGroupMulti.is() )
m_pGroupMulti->dispose(); m_pGroupMulti->dispose();
m_pGroupMulti.clear();
} }
catch (uno::Exception&) catch (uno::Exception&)
{ {

View File

@@ -124,6 +124,7 @@ void SmGraphicWindow::dispose()
{ {
if (mxAccessible.is()) if (mxAccessible.is())
mxAccessible->ClearWin(); // make Accessible nonfunctional mxAccessible->ClearWin(); // make Accessible nonfunctional
mxAccessible.clear();
CaretBlinkStop(); CaretBlinkStop();
ScrollableWindow::dispose(); ScrollableWindow::dispose();
} }

View File

@@ -1423,6 +1423,7 @@ void UnoTreeListBoxImpl::dispose()
{ {
if( mxPeer.is() ) if( mxPeer.is() )
mxPeer->disposeControl(); mxPeer->disposeControl();
mxPeer.clear();
SvTreeListBox::dispose(); SvTreeListBox::dispose();
} }

View File

@@ -1069,6 +1069,7 @@ namespace svxform
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
m_bDisposed = true; m_bDisposed = true;
m_pScriptListener->dispose(); m_pScriptListener->dispose();
m_pScriptListener.clear();
} }

View File

@@ -87,6 +87,7 @@ void SwDBTablePreviewDialog::dispose()
{ {
m_xFrame->setComponent(nullptr, nullptr); m_xFrame->setComponent(nullptr, nullptr);
m_xFrame->dispose(); m_xFrame->dispose();
m_xFrame.clear();
} }
m_pDescriptionFI.clear(); m_pDescriptionFI.clear();
m_pBeamerWIN.clear(); m_pBeamerWIN.clear();

View File

@@ -205,6 +205,7 @@ uno::Sequence< sal_Int8 > SAL_CALL Storage::getImplementationId()
void SAL_CALL Storage::dispose() void SAL_CALL Storage::dispose()
{ {
m_xWrappedStorage->dispose(); m_xWrappedStorage->dispose();
m_xWrappedStorage.clear();
} }