diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-03-10 16:38:36 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-03-11 09:03:05 +0100 |
commit | 5d59315809eae08f2340864dd18f667ce2b24198 (patch) | |
tree | 3e6f7e3a8308fd87f0c38980a3b333071ce1047d /desktop | |
parent | 32e70912a20dc066dd1575e71b18de432a56b135 (diff) |
There's only a single DispatchWatcher, no need for a static mutex member
Change-Id: I410d07210bd80379fd2de1b8d76843794fa5f660
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/dispatchwatcher.cxx | 19 | ||||
-rw-r--r-- | desktop/source/app/dispatchwatcher.hxx | 2 |
2 files changed, 5 insertions, 16 deletions
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 3ba4e152c29a..35864f18b3a3 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -58,7 +58,6 @@ #include <osl/thread.hxx> #include <osl/file.hxx> #include <osl/file.h> -#include <rtl/instance.hxx> #include <iostream> using namespace ::osl; @@ -170,16 +169,6 @@ OUString impl_GuessFilter( const OUString& rUrlOut, const OUString& rDocService } -namespace -{ - class theWatcherMutex : public rtl::Static<Mutex, theWatcherMutex> {}; -} - -Mutex& DispatchWatcher::GetMutex() -{ - return theWatcherMutex::get(); -} - DispatchWatcher::DispatchWatcher() : m_nRequestCount(0) { @@ -317,7 +306,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ if( xDispatcher.is() ) { { - ::osl::ClearableMutexGuard aGuard( GetMutex() ); + ::osl::ClearableMutexGuard aGuard(m_mutex); // Remember request so we can find it in statusChanged! m_aRequestContainer.emplace(aURL.Complete, 1); m_nRequestCount++; @@ -698,7 +687,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ xDisp->dispatchWithNotification( aDispatches[n].aURL, aArgs, this ); else { - ::osl::ClearableMutexGuard aGuard( GetMutex() ); + ::osl::ClearableMutexGuard aGuard(m_mutex); m_nRequestCount--; aGuard.clear(); xDispatch->dispatch( aDispatches[n].aURL, aArgs ); @@ -706,7 +695,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ } } - ::osl::ClearableMutexGuard aGuard( GetMutex() ); + ::osl::ClearableMutexGuard aGuard(m_mutex); bool bEmpty = (m_nRequestCount == 0); aGuard.clear(); @@ -738,7 +727,7 @@ void SAL_CALL DispatchWatcher::disposing( const css::lang::EventObject& ) void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& ) throw( RuntimeException, std::exception ) { - osl::ClearableMutexGuard aGuard( GetMutex() ); + osl::ClearableMutexGuard aGuard(m_mutex); sal_Int16 nCount = --m_nRequestCount; aGuard.clear(); OfficeIPCThread::RequestsCompleted(); diff --git a/desktop/source/app/dispatchwatcher.hxx b/desktop/source/app/dispatchwatcher.hxx index 13c5b253ffd9..a71c54bfbf23 100644 --- a/desktop/source/app/dispatchwatcher.hxx +++ b/desktop/source/app/dispatchwatcher.hxx @@ -85,7 +85,7 @@ class DispatchWatcher : public ::cppu::WeakImplHelper< css::frame::XDispatchResu bool executeDispatchRequests( const DispatchList& aDispatches, bool bNoTerminate = false ); private: - static ::osl::Mutex& GetMutex(); + osl::Mutex m_mutex; std::unordered_map<OUString, sal_Int32, OUStringHash> m_aRequestContainer; |