summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-09-12 13:32:21 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-09-12 14:57:24 +0200
commit9cef1d069a21cb821b1ef880da0358aa2a959a40 (patch)
treed5dd3949236942a7cb77911659d925aec2979891
parentf05605997ffcfbf3b7969f565556a261c8e61a42 (diff)
loplugin:unodispose in UnoControls
Change-Id: Id3cc80804b982cec04e288d0709c5d402e69860d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156841 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--UnoControls/source/base/basecontrol.cxx1
-rw-r--r--UnoControls/source/controls/framecontrol.cxx46
-rw-r--r--UnoControls/source/controls/statusindicator.cxx2
-rw-r--r--UnoControls/source/inc/framecontrol.hxx2
4 files changed, 22 insertions, 29 deletions
diff --git a/UnoControls/source/base/basecontrol.cxx b/UnoControls/source/base/basecontrol.cxx
index d926323bd268..146239f177a8 100644
--- a/UnoControls/source/base/basecontrol.cxx
+++ b/UnoControls/source/base/basecontrol.cxx
@@ -171,6 +171,7 @@ void SAL_CALL BaseControl::dispose()
{
// to all other paint, focus, etc.
m_xMultiplexer->disposeAndClear();
+ m_xMultiplexer.clear();
}
// set the service manager to disposed
diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx
index 87dd4a07f6f9..f58c77a3b76a 100644
--- a/UnoControls/source/controls/framecontrol.cxx
+++ b/UnoControls/source/controls/framecontrol.cxx
@@ -175,7 +175,25 @@ Reference< XControlModel > SAL_CALL FrameControl::getModel()
void SAL_CALL FrameControl::dispose()
{
- impl_deleteFrame();
+ Reference< XFrame2 > xOldFrame;
+ {
+ // do not dispose the frame in this guarded section (deadlock?)
+ MutexGuard aGuard( m_aMutex );
+ xOldFrame = std::move(m_xFrame);
+ }
+
+ // notify the listeners
+ sal_Int32 nFrameId = PropertyHandle::Frame;
+ Reference< XFrame2 > xNullFrame;
+ Any aNewFrame( &xNullFrame, cppu::UnoType<XFrame2>::get());
+ Any aOldFrame( &xOldFrame, cppu::UnoType<XFrame2>::get());
+ fire( &nFrameId, &aNewFrame, &aOldFrame, 1, false );
+
+ // dispose the frame
+ if( xOldFrame.is() )
+ xOldFrame->dispose();
+
+ m_aConnectionPointContainer.clear();
BaseControl::dispose();
}
@@ -402,32 +420,6 @@ void FrameControl::impl_createFrame( const Reference< XWindowPeer >& xPee
}
}
-// private method
-
-void FrameControl::impl_deleteFrame()
-{
- Reference< XFrame2 > xOldFrame;
- Reference< XFrame2 > xNullFrame;
-
- {
- // do not dispose the frame in this guarded section (deadlock?)
- MutexGuard aGuard( m_aMutex );
- xOldFrame = m_xFrame;
- m_xFrame.clear();
- }
-
- // notify the listeners
- sal_Int32 nFrameId = PropertyHandle::Frame;
- Any aNewFrame( &xNullFrame, cppu::UnoType<XFrame2>::get());
- Any aOldFrame( &xOldFrame, cppu::UnoType<XFrame2>::get());
- fire( &nFrameId, &aNewFrame, &aOldFrame, 1, false );
-
- // dispose the frame
- if( xOldFrame.is() )
- xOldFrame->dispose();
-}
-
-
} // namespace unocontrols
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
diff --git a/UnoControls/source/controls/statusindicator.cxx b/UnoControls/source/controls/statusindicator.cxx
index 448b193d9a61..d35b5f99b191 100644
--- a/UnoControls/source/controls/statusindicator.cxx
+++ b/UnoControls/source/controls/statusindicator.cxx
@@ -288,6 +288,8 @@ void SAL_CALL StatusIndicator::dispose ()
// when other hold a reference at this object !!!
xTextControl->dispose();
m_xProgressBar->dispose();
+ m_xProgressBar.clear();
+ m_xText.clear();
BaseContainerControl::dispose();
}
diff --git a/UnoControls/source/inc/framecontrol.hxx b/UnoControls/source/inc/framecontrol.hxx
index a1a2afc07be4..514e7cd79994 100644
--- a/UnoControls/source/inc/framecontrol.hxx
+++ b/UnoControls/source/inc/framecontrol.hxx
@@ -155,8 +155,6 @@ private:
const OUString& sURL ,
const css::uno::Sequence< css::beans::PropertyValue >& seqArguments );
- void impl_deleteFrame();
-
css::uno::Reference< css::frame::XFrame2 > m_xFrame;
OUString m_sComponentURL;
css::uno::Sequence< css::beans::PropertyValue > m_seqLoaderArguments;