Kaydet (Commit) 43ed93b2 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Use SolarMutexGuard directly

Change-Id: Ia8c994a86f1693dd1f06b2f1183f392e0ba4bdd2
üst 445ec65a
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef INCLUDED_FRAMEWORK_INC_DISPATCH_INTERCEPTIONHELPER_HXX #ifndef INCLUDED_FRAMEWORK_INC_DISPATCH_INTERCEPTIONHELPER_HXX
#define INCLUDED_FRAMEWORK_INC_DISPATCH_INTERCEPTIONHELPER_HXX #define INCLUDED_FRAMEWORK_INC_DISPATCH_INTERCEPTIONHELPER_HXX
#include <threadhelp/threadhelpbase.hxx>
#include <macros/xinterface.hxx> #include <macros/xinterface.hxx>
#include <macros/generic.hxx> #include <macros/generic.hxx>
#include <general.h> #include <general.h>
...@@ -48,9 +47,7 @@ namespace framework{ ...@@ -48,9 +47,7 @@ namespace framework{
@attention Don't use this class as direct member - use it dynamicly. Do not derive from this class. @attention Don't use this class as direct member - use it dynamicly. Do not derive from this class.
We hold a weakreference to ouer owner not to ouer superclass. We hold a weakreference to ouer owner not to ouer superclass.
*/ */
class InterceptionHelper : // order of base classes is important for right initialization of mutex member! class InterceptionHelper : public ::cppu::WeakImplHelper3<
private ThreadHelpBase,
public ::cppu::WeakImplHelper3<
css::frame::XDispatchProvider, css::frame::XDispatchProvider,
css::frame::XDispatchProviderInterception, css::frame::XDispatchProviderInterception,
css::lang::XEventListener > css::lang::XEventListener >
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
*/ */
#include <dispatch/interceptionhelper.hxx> #include <dispatch/interceptionhelper.hxx>
#include <threadhelp/guard.hxx>
#include <com/sun/star/frame/XInterceptorInfo.hpp> #include <com/sun/star/frame/XInterceptorInfo.hpp>
...@@ -34,10 +33,7 @@ sal_Bool InterceptionHelper::m_bPreferrFirstInterceptor = sal_True; ...@@ -34,10 +33,7 @@ sal_Bool InterceptionHelper::m_bPreferrFirstInterceptor = sal_True;
InterceptionHelper::InterceptionHelper(const css::uno::Reference< css::frame::XFrame >& xOwner, InterceptionHelper::InterceptionHelper(const css::uno::Reference< css::frame::XFrame >& xOwner,
const css::uno::Reference< css::frame::XDispatchProvider >& xSlave) const css::uno::Reference< css::frame::XDispatchProvider >& xSlave)
// Init baseclasses first : m_xOwnerWeak (xOwner )
: ThreadHelpBase(&Application::GetSolarMutex())
// Init member
, m_xOwnerWeak (xOwner )
, m_xSlave (xSlave ) , m_xSlave (xSlave )
{ {
} }
...@@ -52,7 +48,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD ...@@ -52,7 +48,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD
throw(css::uno::RuntimeException, std::exception) throw(css::uno::RuntimeException, std::exception)
{ {
// SAFE { // SAFE {
Guard aReadLock(m_aLock); SolarMutexClearableGuard aReadLock;
// a) first search an interceptor, which match to this URL by it's URL pattern registration // a) first search an interceptor, which match to this URL by it's URL pattern registration
// Note: if it return NULL - it does not mean an empty interceptor list automaticly! // Note: if it return NULL - it does not mean an empty interceptor list automaticly!
...@@ -78,7 +74,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD ...@@ -78,7 +74,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD
if (!xInterceptor.is() && m_xSlave.is()) if (!xInterceptor.is() && m_xSlave.is())
xInterceptor = m_xSlave; xInterceptor = m_xSlave;
aReadLock.unlock(); aReadLock.clear();
// } SAFE // } SAFE
css::uno::Reference< css::frame::XDispatch > xReturn; css::uno::Reference< css::frame::XDispatch > xReturn;
...@@ -125,7 +121,7 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css: ...@@ -125,7 +121,7 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
} }
// SAFE { // SAFE {
Guard aWriteLock(m_aLock); SolarMutexClearableGuard aWriteLock;
// a) no interceptor at all - set this instance as master for given interceptor // a) no interceptor at all - set this instance as master for given interceptor
// and set our slave as it's slave - and put this interceptor to the list. // and set our slave as it's slave - and put this interceptor to the list.
...@@ -172,7 +168,7 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css: ...@@ -172,7 +168,7 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY); css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
aWriteLock.unlock(); aWriteLock.clear();
// } SAFE // } SAFE
// Don't forget to send a frame action event "context changed". // Don't forget to send a frame action event "context changed".
...@@ -190,7 +186,7 @@ void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css:: ...@@ -190,7 +186,7 @@ void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css::
throw css::uno::RuntimeException("NULL references not allowed as in parameter", xThis); throw css::uno::RuntimeException("NULL references not allowed as in parameter", xThis);
// SAFE { // SAFE {
Guard aWriteLock(m_aLock); SolarMutexClearableGuard aWriteLock;
// search this interceptor ... // search this interceptor ...
// If it could be located inside cache - // If it could be located inside cache -
...@@ -219,7 +215,7 @@ void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css:: ...@@ -219,7 +215,7 @@ void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css::
css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY); css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
aWriteLock.unlock(); aWriteLock.clear();
// } SAFE // } SAFE
// Don't forget to send a frame action event "context changed". // Don't forget to send a frame action event "context changed".
...@@ -234,7 +230,7 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent ...@@ -234,7 +230,7 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent
{ {
#ifdef FORCE_DESTRUCTION_OF_INTERCEPTION_CHAIN #ifdef FORCE_DESTRUCTION_OF_INTERCEPTION_CHAIN
// SAFE -> // SAFE ->
Guard aReadLock(m_aLock); SolarMutexResettableGuard aReadLock;
// check calli ... we accept such disposing call's only from our onwer frame. // check calli ... we accept such disposing call's only from our onwer frame.
css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY); css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
...@@ -250,7 +246,7 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent ...@@ -250,7 +246,7 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent
// Because this vetor will be influenced by every deregistered interceptor. // Because this vetor will be influenced by every deregistered interceptor.
InterceptionHelper::InterceptorList aCopy = m_lInterceptionRegs; InterceptionHelper::InterceptorList aCopy = m_lInterceptionRegs;
aReadLock.unlock(); aReadLock.clear();
// <- SAFE // <- SAFE
InterceptionHelper::InterceptorList::iterator pIt; InterceptionHelper::InterceptorList::iterator pIt;
...@@ -271,10 +267,10 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent ...@@ -271,10 +267,10 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
// SAFE -> // SAFE ->
aReadLock.lock(); aReadLock.reset();
if (!m_lInterceptionRegs.empty() ) if (!m_lInterceptionRegs.empty() )
OSL_FAIL("There are some pending interceptor objects, which seems to be registered during (!) the destruction of a frame."); OSL_FAIL("There are some pending interceptor objects, which seems to be registered during (!) the destruction of a frame.");
aReadLock.unlock(); aReadLock.clear();
// <- SAFE // <- SAFE
#endif // ODL_DEBUG_LEVEL>0 #endif // ODL_DEBUG_LEVEL>0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment