summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-12-18 16:16:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-18 16:28:15 +0100
commit54b80473f4a4b8ac3dfc1936b2214733474a3485 (patch)
treec252a00f59af3d6addafe45cf8e2d8f4b9086ad2 /toolkit
parentebc9cb8ae21c5930887cf27e1dbbe2c7493f3e30 (diff)
tdf#146286 Crash/hang calling context menu
regression from commit b37f9fbf05e16eb58eae40c6d900a4b9da2972db osl::Mutex->std::mutex in VCLXMenu Change-Id: I60caa02f9d8bb40b7fcf8a1009aeeac6ff3a094c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127044 Tested-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/vclxmenu.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index 01e275aacf82..eca9de23fa12 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -479,16 +479,17 @@ sal_Int16 VCLXMenu::execute(
sal_Int16 nFlags )
{
SolarMutexGuard aSolarGuard;
- std::unique_lock aGuard( maMutex );
-
- sal_Int16 nRet = 0;
- if ( mpMenu && IsPopupMenu() )
+ auto pMenu = mpMenu;
{
- nRet = static_cast<PopupMenu*>(mpMenu.get())->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ),
- VCLRectangle( rPos ),
- static_cast<PopupMenuFlags>(nFlags) | PopupMenuFlags::NoMouseUpClose );
+ std::unique_lock aGuard( maMutex );
+ if ( !mpMenu || !IsPopupMenu() )
+ return 0;
}
- return nRet;
+ // cannot call this with mutex locked because it will call back into us
+ return static_cast<PopupMenu*>(pMenu.get())->Execute(
+ VCLUnoHelper::GetWindow( rxWindowPeer ),
+ VCLRectangle( rPos ),
+ static_cast<PopupMenuFlags>(nFlags) | PopupMenuFlags::NoMouseUpClose );
}