summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2024-03-20 21:42:50 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2024-04-22 14:08:56 +0200
commit83ac63d00243467ddaa9ed8031a8fa8ada20d1fb (patch)
treec6b53cd01a164b74f3c25e732916e1246e2f8df5
parent3cc0ad389b7acec230652d9b80ed6b7fe985732d (diff)
framework: MenuBarManager: fix WNT crash if queryDispatch() throws
a Java extension throws RuntimeException from queryDispatch(), which is translated to a C++ exception and thrown by the mscx_uno bridge, and this is apparently not handled anywhere (Visual Studio says "Unhandled Exception"), and what happens then apparently is the exception goes poof and vanishes, and normal return from the mscx_uno bridge code happens, but the out parameter used for the return value is never initialised, and then the uno::Reference move assignment operator crashes. Change-Id: I21535fcf0ab4ec30a712d01b5039b7e2fb7b09d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165081 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 447a15f4772bcbc9366cfa43b92c55ae644e9b03) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165114 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--framework/source/uielement/menubarmanager.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index edbd88d2250c..fce1929d28e7 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -664,7 +664,16 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
if ( aTargetURL.Complete.startsWith( ".uno:StyleApply?" ) )
xMenuItemDispatch = new StyleDispatcher( m_xFrame, m_xURLTransformer, aTargetURL );
else
- xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, menuItemHandler->aTargetFrame, 0 );
+ {
+ try
+ {
+ xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, menuItemHandler->aTargetFrame, 0 );
+ }
+ catch (uno::Exception const&)
+ {
+ TOOLS_WARN_EXCEPTION("fwk.uielement", "MenuBarManager::Activate(): exception from queryDispatch()");
+ }
+ }
bool bPopupMenu( false );
if ( !menuItemHandler->xPopupMenuController.is() &&