[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - framework/source
Caolán McNamara
caolanm at redhat.com
Tue Dec 9 02:21:11 PST 2014
framework/source/uielement/toolbarmanager.cxx | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
New commits:
commit 1b7c6316a5dff542b6aadd422e353e3623ebce46
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Dec 8 12:10:37 2014 +0000
Resolves: fdo#86820 executing toolbar menu entry can destroy menu
Change-Id: Ide0ea8f8ff145d487e409b0091918b59f1f83405
(cherry picked from commit eae0dda3e2eddb55b4e2032136541c15ba87fa09)
Reviewed-on: https://gerrit.libreoffice.org/13378
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 4f11ff3..c9bc41f 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -1791,17 +1791,24 @@ IMPL_LINK( ToolBarManager, Command, CommandEvent*, pCmdEvt )
// overflow and context menus). If we set these Hdls permanently rather
// than just when the context menu is showing, then events are duplicated
// when the menu is being used as an overflow menu.
- m_pToolBar->GetMenu()->SetSelectHdl( LINK( this, ToolBarManager, MenuSelect ) );
- m_pToolBar->GetMenu()->SetDeactivateHdl( LINK( this, ToolBarManager, MenuDeactivate ) );
+ Menu *pManagerMenu = m_pToolBar->GetMenu();
+ pManagerMenu->SetSelectHdl( LINK( this, ToolBarManager, MenuSelect ) );
+ pManagerMenu->SetDeactivateHdl( LINK( this, ToolBarManager, MenuDeactivate ) );
// make sure all disabled entries will be shown
pMenu->SetMenuFlags( pMenu->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES );
::Point aPoint( pCmdEvt->GetMousePosPixel() );
pMenu->Execute( m_pToolBar, aPoint );
- // Unlink our listeners again -- see above for why.
- m_pToolBar->GetMenu()->SetSelectHdl( Link() );
- m_pToolBar->GetMenu()->SetDeactivateHdl( Link() );
+ //fdo#86820 We may have been disposed and so have a NULL m_pToolBar by
+ //executing a menu entry, e.g. inserting a chart replaces the toolbars
+ pManagerMenu = m_bDisposed ? NULL : m_pToolBar->GetMenu();
+ if (pManagerMenu)
+ {
+ // Unlink our listeners again -- see above for why.
+ pManagerMenu->SetSelectHdl( Link() );
+ pManagerMenu->SetDeactivateHdl( Link() );
+ }
}
return 0;
More information about the Libreoffice-commits
mailing list