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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 6 21:10:53 UTC 2018


 framework/inc/dispatch/interceptionhelper.hxx    |    4 +---
 framework/inc/uielement/toolbarmanager.hxx       |   10 ++++------
 framework/source/dispatch/interceptionhelper.cxx |   21 +++++++--------------
 framework/source/uielement/toolbarmanager.cxx    |   11 -----------
 4 files changed, 12 insertions(+), 34 deletions(-)

New commits:
commit b98bef638e7352918dd487c6dd0769e9e896a61e
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Fri Sep 7 00:08:22 2018 +0300
Commit:     Vasily Melenchuk <vasily.melenchuk at cib.de>
CommitDate: Fri Sep 7 00:08:22 2018 +0300

    Revert "debug: let's disable dispatch interceptors for a while"
    
    This reverts commit 3b6fdf5eb0f6571383880e8c6af450a0e0069fca.
    
    Change-Id: I3c11a11061f4a4395f7bf2a1dfaed3f25721d448

diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx
old mode 100755
new mode 100644
index 4b4c217d232f..3e6a0fa68df4
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -20,7 +20,7 @@
 #include <dispatch/interceptionhelper.hxx>
 
 #include <com/sun/star/frame/XInterceptorInfo.hpp>
-#include <com/sun/star/util/URLTransformer.hpp>
+
 #include <vcl/svapp.hxx>
 
 namespace framework{
@@ -76,7 +76,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD
     // c) No registered interceptor => use our direct slave.
     //    This helper exist by design and must be valid everytimes ...
     //    But to be more feature proof - we should check that .-)
-    //if (!xInterceptor.is() && m_xSlave.is())
+    if (!xInterceptor.is() && m_xSlave.is())
         xInterceptor = m_xSlave;
 
     aReadLock.clear();
@@ -105,19 +105,6 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL Inte
 void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor)
     throw(css::uno::RuntimeException, std::exception)
 {
-    // testrun
-    {
-        css::uno::Reference<css::frame::XFrame> xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
-        css::util::URL aTargetURL(".uno:Save", ".uno:Save", ".uno:", "", "", "", 0, "Save", "", "",
-                                  "");
-        /*aTargetURL.Complete = ".uno:Save";
-        css::uno::Reference<css::util::XURLTransformer> m_xUrlTransformer
-            = css::util::URLTransformer::create(xOwner);
-        if (m_xUrlTransformer.is())
-            m_xUrlTransformer->parseStrict(aTargetURL);*/
-        xInterceptor->queryDispatch(aTargetURL, OUString(), 0);
-    }
-
     osl::Guard<osl::Mutex> aGuard(m_Mutex);
 
     // reject incorrect calls of this interface method
commit 7f0832b4fb35f61d64b8b5039c61fb5784cdd146
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Fri Sep 7 00:06:50 2018 +0300
Commit:     Vasily Melenchuk <vasily.melenchuk at cib.de>
CommitDate: Fri Sep 7 00:06:50 2018 +0300

    Revert "framework: [experimental] add additional race conditions blockers"
    
    This reverts commit f77744a7911ae846fbc401aad5dea37510a7f283.

diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx
index 11d9025182c0..48722dec5acb 100644
--- a/framework/inc/uielement/toolbarmanager.hxx
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -52,7 +52,6 @@
 #include <vcl/timer.hxx>
 
 #include <unordered_map>
-#include <atomic>
 
 class PopupMenu;
 class ToolBox;
@@ -156,11 +155,10 @@ class ToolBarManager : public ToolbarManager_Base
 
         typedef std::unordered_map< sal_uInt16, css::uno::Reference< css::container::XIndexAccess > > MenuDescriptionMap;
 
-        bool m_bAddedToTaskPaneList : 1,
-             m_bFrameActionRegistered : 1;
-        std::atomic<bool> m_bDisposed;
-        std::atomic<bool> m_bDisposing;
-        std::atomic<bool> m_bUpdateControllers;
+        bool m_bDisposed : 1,
+             m_bAddedToTaskPaneList : 1,
+             m_bFrameActionRegistered : 1,
+             m_bUpdateControllers : 1;
 
         sal_Int16 m_eSymbolSize;
 
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index b67188d60d48..489ad878715a 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -139,7 +139,6 @@ 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 ),
@@ -330,10 +329,6 @@ void ToolBarManager::RefreshImages()
 
 void ToolBarManager::UpdateControllers()
 {
-    if ( m_bDisposing )
-    {
-        return;
-    }
 
     if( SvtMiscOptions().DisableUICustomization() )
     {
@@ -378,10 +373,6 @@ 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 )
     {
@@ -466,7 +457,6 @@ void SAL_CALL ToolBarManager::dispose() throw( RuntimeException, std::exception
 
     {
         SolarMutexGuard g;
-        m_bDisposing = true;
 
         if (m_bDisposed)
         {
@@ -528,7 +518,6 @@ void SAL_CALL ToolBarManager::dispose() throw( RuntimeException, std::exception
         m_aAsyncUpdateControllersTimer.Stop();
 
         m_bDisposed = true;
-        m_bDisposing = false;
     }
 }
 
commit 67dfc08aefa9a9679e92e0a9855013692e656c7a
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Fri Sep 7 00:00:28 2018 +0300
Commit:     Vasily Melenchuk <vasily.melenchuk at cib.de>
CommitDate: Fri Sep 7 00:05:38 2018 +0300

    framework: use own mutex for interceptors call
    
    instead of SolarMutex blocking not entire methods let's try to use
    own mutex (with guard) to lock only InterceptionHelper critical
    parts. Anyway, SolarMutex here looks like overhead.
    
    Change-Id: I572b796cb351035c48d0b496ae0b54ef26a18682

diff --git a/framework/inc/dispatch/interceptionhelper.hxx b/framework/inc/dispatch/interceptionhelper.hxx
old mode 100644
new mode 100755
index ee6ae9db1b97..e49d8ea9dc44
--- a/framework/inc/dispatch/interceptionhelper.hxx
+++ b/framework/inc/dispatch/interceptionhelper.hxx
@@ -142,9 +142,7 @@ class InterceptionHelper : public  ::cppu::WeakImplHelper<
         /** @short contains all registered interceptor objects. */
         InterceptorList m_lInterceptionRegs;
 
-        /** @short it regulates, which interceptor is used first.
-                   The last or the first registered one. */
-        static bool m_bPreferrFirstInterceptor;
+        osl::Mutex m_Mutex;
 
     // native interface
 
diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx
index afc74ab8b03c..4b4c217d232f 100755
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -43,6 +43,8 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD
                                                                                               sal_Int32        nSearchFlags    )
     throw(css::uno::RuntimeException, std::exception)
 {
+    osl::Guard<osl::Mutex> aGuard(m_Mutex);
+
     // SAFE {
     SolarMutexClearableGuard aReadLock;
 
@@ -116,6 +118,8 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
         xInterceptor->queryDispatch(aTargetURL, OUString(), 0);
     }
 
+    osl::Guard<osl::Mutex> aGuard(m_Mutex);
+
     // reject incorrect calls of this interface method
     css::uno::Reference< css::frame::XDispatchProvider > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
     if (!xInterceptor.is())
@@ -195,6 +199,7 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
 void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor)
     throw(css::uno::RuntimeException, std::exception)
 {
+    osl::Guard<osl::Mutex> aGuard(m_Mutex);
     // reject wrong calling of this interface method
     css::uno::Reference< css::frame::XDispatchProvider > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
     if (!xInterceptor.is())
@@ -243,6 +248,7 @@ void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css::
 void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent)
     throw(css::uno::RuntimeException, std::exception)
 {
+    osl::Guard<osl::Mutex> aGuard(m_Mutex);
     #ifdef FORCE_DESTRUCTION_OF_INTERCEPTION_CHAIN
     // SAFE ->
     SolarMutexResettableGuard aReadLock;


More information about the Libreoffice-commits mailing list