[Libreoffice-commits] core.git: Branch 'feature/cib_contract935' - framework/inc framework/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 23 19:42:22 UTC 2018


 framework/inc/uielement/toolbarmanager.hxx    |   10 ++++++----
 framework/source/uielement/toolbarmanager.cxx |   11 +++++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit f77744a7911ae846fbc401aad5dea37510a7f283
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Thu Aug 23 22:38:48 2018 +0300
Commit:     Vasily Melenchuk <vasily.melenchuk at cib.de>
CommitDate: Thu Aug 23 22:40:58 2018 +0300

    framework: [experimental] add additional race conditions blockers
    
    Change-Id: I743a93b76886107b8d6a9f36c64bed11afab6ca3

diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx
index 48722dec5acb..11d9025182c0 100644
--- a/framework/inc/uielement/toolbarmanager.hxx
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -52,6 +52,7 @@
 #include <vcl/timer.hxx>
 
 #include <unordered_map>
+#include <atomic>
 
 class PopupMenu;
 class ToolBox;
@@ -155,10 +156,11 @@ class ToolBarManager : public ToolbarManager_Base
 
         typedef std::unordered_map< sal_uInt16, css::uno::Reference< css::container::XIndexAccess > > MenuDescriptionMap;
 
-        bool m_bDisposed : 1,
-             m_bAddedToTaskPaneList : 1,
-             m_bFrameActionRegistered : 1,
-             m_bUpdateControllers : 1;
+        bool m_bAddedToTaskPaneList : 1,
+             m_bFrameActionRegistered : 1;
+        std::atomic<bool> m_bDisposed;
+        std::atomic<bool> m_bDisposing;
+        std::atomic<bool> m_bUpdateControllers;
 
         sal_Int16 m_eSymbolSize;
 
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 489ad878715a..b67188d60d48 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -139,6 +139,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext,
     m_bAddedToTaskPaneList( true ),
     m_bFrameActionRegistered( false ),
     m_bUpdateControllers( false ),
+    m_bDisposing( false ),
     m_eSymbolSize(SvtMiscOptions().GetCurrentSymbolsSize()),
     m_pToolBar( pToolBar ),
     m_aResourceName( rResourceName ),
@@ -329,6 +330,10 @@ void ToolBarManager::RefreshImages()
 
 void ToolBarManager::UpdateControllers()
 {
+    if ( m_bDisposing )
+    {
+        return;
+    }
 
     if( SvtMiscOptions().DisableUICustomization() )
     {
@@ -373,6 +378,10 @@ void ToolBarManager::UpdateControllers()
 //for update toolbar controller via Support Visible
 void ToolBarManager::UpdateController( const css::uno::Reference< css::frame::XToolbarController >& xController)
 {
+    if ( m_bDisposing )
+    {
+        return;
+    }
 
     if ( !m_bUpdateControllers )
     {
@@ -457,6 +466,7 @@ void SAL_CALL ToolBarManager::dispose() throw( RuntimeException, std::exception
 
     {
         SolarMutexGuard g;
+        m_bDisposing = true;
 
         if (m_bDisposed)
         {
@@ -518,6 +528,7 @@ void SAL_CALL ToolBarManager::dispose() throw( RuntimeException, std::exception
         m_aAsyncUpdateControllersTimer.Stop();
 
         m_bDisposed = true;
+        m_bDisposing = false;
     }
 }
 


More information about the Libreoffice-commits mailing list