framework/source/uielement/menubarmanager.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
New commits: commit 447a15f4772bcbc9366cfa43b92c55ae644e9b03 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Mar 20 21:42:50 2024 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Mar 21 10:49:06 2024 +0100 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.st...@allotropia.de> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 770e6b166a1c..0eb7705e66fd 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -660,7 +660,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() &&