diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2017-05-11 17:47:10 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2017-05-14 11:07:29 +0200 |
commit | c606bacc58c517c234a03d1c9b25547cc5766f6d (patch) | |
tree | 77435a8abf778bdb843ea41e812184449a0b810b /framework | |
parent | c7c445e93baf6bbe82f9ed8da02436d1f7e0b237 (diff) |
Allow destroying old MenuBarManager instances
... after dispatch interception change.
To reproduce:
1. Open the testdoc of tdf#102355
2. If not under gtk3 - Open several menus or sub menus.
3. Click the "Intercept" button.
4. Tools > Customize.. > Menus, make some change, click OK.
Expected that old MenuBarManagers (except the top level) are
destructed, and new ones are created. Actually the dtors of
MenuBarManagers from step 2 aren't called (but they will be
eventually called after closing Writer).
The reason we keep active status listening is mainly for
Unity's HUD (see my comment in MenuBarManager::Activate).
But it assumes that Activate was called for all menus,
which is done by GtkSalMenu at application startup,
but not after dispatch interception change. Should we fix
that, or maybe we can just kill this hack (along with
some related code in GtkSalMenu) anytime soon, given
that Unity is officially dead?
Change-Id: Ia1cb24391b393e31c98355dc91833c7511a17cda
Reviewed-on: https://gerrit.libreoffice.org/37589
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 919c77db213a..6ed14c865dc1 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -332,8 +332,17 @@ void SAL_CALL MenuBarManager::frameAction( const FrameActionEvent& Action ) std::vector< MenuItemHandler* >::iterator p; for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); ++p ) { - // Clear dispatch reference as we will requery it later o + // Clear dispatch reference as we will requery it later MenuItemHandler* pItemHandler = *p; + + if ( pItemHandler->xMenuItemDispatch.is() ) + { + URL aTargetURL; + aTargetURL.Complete = pItemHandler->aMenuItemURL; + m_xURLTransformer->parseStrict( aTargetURL ); + + pItemHandler->xMenuItemDispatch->removeStatusListener( this, aTargetURL ); + } pItemHandler->xMenuItemDispatch.clear(); } } |