diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-09-12 13:32:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-09-12 14:57:24 +0200 |
commit | 9cef1d069a21cb821b1ef880da0358aa2a959a40 (patch) | |
tree | d5dd3949236942a7cb77911659d925aec2979891 /UnoControls/source/controls | |
parent | f05605997ffcfbf3b7969f565556a261c8e61a42 (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>
Diffstat (limited to 'UnoControls/source/controls')
-rw-r--r-- | UnoControls/source/controls/framecontrol.cxx | 46 | ||||
-rw-r--r-- | UnoControls/source/controls/statusindicator.cxx | 2 |
2 files changed, 21 insertions, 27 deletions
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(); } |