Kaydet (Commit) c606bacc authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

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/37589Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMaxim Monastirsky <momonasmon@gmail.com>
üst c7c445e9
......@@ -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();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment