[Libreoffice-commits] core.git: vcl/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Dec 13 09:41:37 UTC 2016


 vcl/source/app/vclevent.cxx |   12 +++++++++---
 vcl/source/window/menu.cxx  |   16 +++++++++++++---
 2 files changed, 22 insertions(+), 6 deletions(-)

New commits:
commit 722f4e1d86710f2facd37d7e040df9e1fd585e26
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Dec 13 11:40:29 2016 +0200

    tdf#104573 - Assertion failed: SolarMutex not locked
    
    Change-Id: I91d95e73a7e0831f6667f440dd43567ac55b0529

diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx
index 2cab94c..4fec056 100644
--- a/vcl/source/app/vclevent.cxx
+++ b/vcl/source/app/vclevent.cxx
@@ -92,11 +92,17 @@ VclWindowEvent::VclWindowEvent( vcl::Window* pWin, VclEventId n, void* pDat ) :
 VclWindowEvent::~VclWindowEvent() {}
 
 VclMenuEvent::VclMenuEvent( Menu* pM, VclEventId n, sal_uInt16 nPos )
-    : VclSimpleEvent(n), pMenu(pM), mnPos(nPos)
-{}
+    : VclSimpleEvent(n), mnPos(nPos)
+{
+    SolarMutexGuard aGuard;
+    pMenu = pM;
+}
 
 VclMenuEvent::~VclMenuEvent()
-{}
+{
+    SolarMutexGuard aGuard;
+    pMenu.clear();
+}
 
 Menu* VclMenuEvent::GetMenu() const
 {
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 00b931e..90bd8af 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1407,6 +1407,7 @@ void Menu::ImplAddDel( ImplMenuDelData& rDel )
     SAL_WARN_IF( rDel.mpMenu, "vcl", "Menu::ImplAddDel(): cannot add ImplMenuDelData twice !" );
     if( !rDel.mpMenu )
     {
+        SolarMutexGuard aGuard;
         rDel.mpMenu = this;
         rDel.mpNext = mpFirstDel;
         mpFirstDel = &rDel;
@@ -1415,7 +1416,10 @@ void Menu::ImplAddDel( ImplMenuDelData& rDel )
 
 void Menu::ImplRemoveDel( ImplMenuDelData& rDel )
 {
-    rDel.mpMenu = nullptr;
+    {
+        SolarMutexGuard aGuard;
+        rDel.mpMenu = nullptr;
+    }
     if ( mpFirstDel == &rDel )
     {
         mpFirstDel = rDel.mpNext;
@@ -2601,7 +2605,10 @@ bool Menu::HandleMenuActivateEvent( Menu *pMenu ) const
     {
         ImplMenuDelData aDelData( this );
 
-        pMenu->pStartedFrom = const_cast<Menu*>(this);
+        {
+            SolarMutexGuard aGuard;
+            pMenu->pStartedFrom = const_cast<Menu*>(this);
+        }
         pMenu->bInCallback = true;
         pMenu->Activate();
 
@@ -2617,7 +2624,10 @@ bool Menu::HandleMenuDeActivateEvent( Menu *pMenu ) const
     {
         ImplMenuDelData aDelData( this );
 
-        pMenu->pStartedFrom = const_cast<Menu*>(this);
+        {
+            SolarMutexGuard aGuard;
+            pMenu->pStartedFrom = const_cast<Menu*>(this);
+        }
         pMenu->bInCallback = true;
         pMenu->Deactivate();
         if( !aDelData.isDeleted() )


More information about the Libreoffice-commits mailing list