diff options
author | Henry Castro <hcastro@collabora.com> | 2021-03-30 15:00:49 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2021-04-01 14:07:10 +0200 |
commit | a06f8147fe34c19da168de5d7b26615981cf055e (patch) | |
tree | 6c81be7aa69dd8d8ee1555986144d42f19a20833 /framework/source | |
parent | 5f762b34bb1f93aeb409060d74b8e38ab75a8732 (diff) |
lok: remove frame action listener when disposing
In order to prevent that the frame action listener
holds the object reference count when removed,
ensure they are removed when disposing the object.
Change-Id: If83574e31230d9c683adaf36af36485650fd2c50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113389
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'framework/source')
-rw-r--r-- | framework/source/fwe/helper/titlehelper.cxx | 4 | ||||
-rw-r--r-- | framework/source/helper/persistentwindowstate.cxx | 4 | ||||
-rw-r--r-- | framework/source/helper/tagwindowasmodified.cxx | 3 | ||||
-rw-r--r-- | framework/source/helper/titlebarupdate.cxx | 4 | ||||
-rw-r--r-- | framework/source/uielement/resourcemenucontroller.cxx | 6 |
5 files changed, 21 insertions, 0 deletions
diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index 5936d9133ff3..24d1eb3bf898 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -242,6 +242,10 @@ void SAL_CALL TitleHelper::disposing(const css::lang::EventObject& aEvent) if ( ! xOwner.is ()) return; + css::uno::Reference< css::frame::XFrame > xFrame(xOwner, css::uno::UNO_QUERY); + if (xFrame.is()) + xFrame->removeFrameActionListener(this); + if (xOwner != aEvent.Source) return; diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx index d2e78df8d98c..8121ad025a1c 100644 --- a/framework/source/helper/persistentwindowstate.cxx +++ b/framework/source/helper/persistentwindowstate.cxx @@ -134,6 +134,10 @@ void SAL_CALL PersistentWindowState::frameAction(const css::frame::FrameActionEv void SAL_CALL PersistentWindowState::disposing(const css::lang::EventObject&) { + css::uno::Reference< css::frame::XFrame > xFrame(m_xFrame.get(), css::uno::UNO_QUERY); + if (xFrame.is()) + xFrame->removeFrameActionListener(this); + // nothing todo here - because we hold the frame as weak reference only } diff --git a/framework/source/helper/tagwindowasmodified.cxx b/framework/source/helper/tagwindowasmodified.cxx index f17594cee477..93f2ace64c99 100644 --- a/framework/source/helper/tagwindowasmodified.cxx +++ b/framework/source/helper/tagwindowasmodified.cxx @@ -123,6 +123,9 @@ void SAL_CALL TagWindowAsModified::disposing(const css::lang::EventObject& aEven SolarMutexGuard g; css::uno::Reference< css::frame::XFrame > xFrame(m_xFrame.get(), css::uno::UNO_QUERY); + if (xFrame.is()) + xFrame->addFrameActionListener(this); + if ( (xFrame.is () ) && (aEvent.Source == xFrame) diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx index d62be2a63192..0ca094c6d5b0 100644 --- a/framework/source/helper/titlebarupdate.cxx +++ b/framework/source/helper/titlebarupdate.cxx @@ -103,6 +103,10 @@ void SAL_CALL TitleBarUpdate::titleChanged(const css::frame::TitleChangedEvent& void SAL_CALL TitleBarUpdate::disposing(const css::lang::EventObject&) { + css::uno::Reference< css::frame::XFrame > xFrame(m_xFrame.get(), css::uno::UNO_QUERY); + if (xFrame.is()) + xFrame->removeFrameActionListener(this); + // nothing todo here - because we hold the frame as weak reference only } diff --git a/framework/source/uielement/resourcemenucontroller.cxx b/framework/source/uielement/resourcemenucontroller.cxx index 26198c0cf5f6..81bacc75ae70 100644 --- a/framework/source/uielement/resourcemenucontroller.cxx +++ b/framework/source/uielement/resourcemenucontroller.cxx @@ -317,6 +317,9 @@ void ResourceMenuController::disposing( const css::lang::EventObject& rEvent ) { if ( m_xMenuBarManager.is() ) { + if (m_xFrame.is()) + m_xFrame->removeFrameActionListener( m_xMenuBarManager ); + m_xMenuBarManager->dispose(); m_xMenuBarManager.clear(); } @@ -340,6 +343,9 @@ void ResourceMenuController::disposing() m_xDispatchProvider.clear(); if ( m_xMenuBarManager.is() ) { + if (m_xFrame.is()) + m_xFrame->removeFrameActionListener( m_xMenuBarManager ); + m_xMenuBarManager->dispose(); m_xMenuBarManager.clear(); } |