summaryrefslogtreecommitdiff
path: root/framework/source/uielement/popuptoolbarcontroller.cxx
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2017-02-12 22:14:48 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2017-02-12 21:56:29 +0000
commit81d4fbc0daa54889ccb09e6a3fadff9c70d99448 (patch)
treee76c9281a295dda0e1b25316efc77640ad3dc3bf /framework/source/uielement/popuptoolbarcontroller.cxx
parente5aa7a5b5753c57969fc2e17fb334781bb2a0481 (diff)
tdf#42029 Use a floating toolbar to show clipped items
Change-Id: I6b366f115258ef8497807163179d3e08ab3d5e6f Reviewed-on: https://gerrit.libreoffice.org/34180 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework/source/uielement/popuptoolbarcontroller.cxx')
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index b04c831e7a12..34b3a39cf528 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -200,7 +200,13 @@ PopupMenuToolbarController::createPopupWindow()
pToolBox->SetItemDown( m_nToolBoxId, true );
WindowAlign eAlign( pToolBox->GetAlign() );
- sal_uInt16 nId = m_xPopupMenu->execute(
+
+ // If the parent ToolBox is in popup mode (e.g. sub toolbar, overflow popup),
+ // its ToolBarManager can be disposed along with our controller, destroying
+ // m_xPopupMenu, while the latter still in execute. This should be fixed at a
+ // different level, for now just hold it here so it won't crash.
+ css::uno::Reference< css::awt::XPopupMenu > xPopupMenu ( m_xPopupMenu );
+ sal_uInt16 nId = xPopupMenu->execute(
css::uno::Reference< css::awt::XWindowPeer >( getParent(), css::uno::UNO_QUERY ),
VCLUnoHelper::ConvertToAWTRect( pToolBox->GetItemRect( m_nToolBoxId ) ),
( eAlign == WindowAlign::Top || eAlign == WindowAlign::Bottom ) ?
@@ -209,7 +215,7 @@ PopupMenuToolbarController::createPopupWindow()
pToolBox->SetItemDown( m_nToolBoxId, false );
if ( nId )
- functionExecuted( m_xPopupMenu->getCommand( nId ) );
+ functionExecuted( xPopupMenu->getCommand( nId ) );
return xRet;
}