[Libreoffice-commits] core.git: Branch 'feature/cib_contract935' - framework/inc framework/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Sep 10 20:03:36 UTC 2018
framework/inc/dispatch/interceptionhelper.hxx | 2 -
framework/source/dispatch/interceptionhelper.cxx | 26 ++++++++++++++++++-----
2 files changed, 21 insertions(+), 7 deletions(-)
New commits:
commit 6568768caf4e05d83495eecad4dca23d641795ca
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Mon Sep 10 22:40:46 2018 +0300
Commit: Vasily Melenchuk <vasily.melenchuk at cib.de>
CommitDate: Mon Sep 10 23:01:07 2018 +0300
framework: mutex locking revision
- revert own mutex, use SolarMutex as before
- extend SolarMutex protected area until queryDispatch() finish
Change-Id: Ie94b120a594aff8a3a443b3eb6ee723eb3d5a26f
diff --git a/framework/inc/dispatch/interceptionhelper.hxx b/framework/inc/dispatch/interceptionhelper.hxx
index 8ada47f696a2..ee6ae9db1b97 100755
--- a/framework/inc/dispatch/interceptionhelper.hxx
+++ b/framework/inc/dispatch/interceptionhelper.hxx
@@ -146,8 +146,6 @@ class InterceptionHelper : public ::cppu::WeakImplHelper<
The last or the first registered one. */
static bool m_bPreferrFirstInterceptor;
- osl::Mutex m_Mutex;
-
// native interface
public:
diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx
index 9342cfab8f52..55ee63ba1e83 100644
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -43,7 +43,7 @@ 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);
+ SolarMutexGuard aLock;
// a) first search an interceptor, which match to this URL by its URL pattern registration
// Note: if it return NULL - it does not mean an empty interceptor list automatically!
@@ -99,8 +99,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)
{
- 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())
@@ -121,6 +119,9 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
aInfo.lURLPattern[0] = "*";
}
+ // SAFE {
+ SolarMutexClearableGuard aWriteLock;
+
// a) no interceptor at all - set this instance as master for given interceptor
// and set our slave as its slave - and put this interceptor to the list.
// Its place there doesn't matter. Because this list is currently empty.
@@ -165,6 +166,9 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
+ aWriteLock.clear();
+ // } SAFE
+
// Don't forget to send a frame action event "context changed".
// Any cached dispatch objects must be validated now!
if (xOwner.is())
@@ -174,12 +178,14 @@ 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())
throw css::uno::RuntimeException("NULL references not allowed as in parameter", xThis);
+ // SAFE {
+ SolarMutexClearableGuard aWriteLock;
+
// search this interceptor ...
// If it could be located inside cache -
// use its slave/master relations to update the interception list;
@@ -207,6 +213,9 @@ void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css::
css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
+ aWriteLock.clear();
+ // } SAFE
+
// Don't forget to send a frame action event "context changed".
// Any cached dispatch objects must be validated now!
if (xOwner.is())
@@ -217,8 +226,9 @@ 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;
// check call... we accept such disposing calls only from our owner frame.
css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
@@ -234,6 +244,9 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent
// Because this vetor will be influenced by every deregistered interceptor.
InterceptionHelper::InterceptorList aCopy = m_lInterceptionRegs;
+ aReadLock.clear();
+ // <- SAFE
+
InterceptionHelper::InterceptorList::iterator pIt;
for ( pIt = aCopy.begin();
pIt != aCopy.end();
@@ -252,8 +265,11 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent
#if OSL_DEBUG_LEVEL > 0
// SAFE ->
+ aReadLock.reset();
if (!m_lInterceptionRegs.empty() )
OSL_FAIL("There are some pending interceptor objects, which seems to be registered during (!) the destruction of a frame.");
+ aReadLock.clear();
+ // <- SAFE
#endif // ODL_DEBUG_LEVEL>0
#endif // FORCE_DESTRUCTION_OF_INTERCEPTION_CHAIN
More information about the Libreoffice-commits
mailing list