[Libreoffice-commits] core.git: desktop/source
Stephan Bergmann
sbergman at redhat.com
Fri Mar 11 08:03:28 UTC 2016
desktop/source/app/dispatchwatcher.cxx | 19 ++++---------------
desktop/source/app/dispatchwatcher.hxx | 2 +-
2 files changed, 5 insertions(+), 16 deletions(-)
New commits:
commit 5d59315809eae08f2340864dd18f667ce2b24198
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Mar 10 16:38:36 2016 +0100
There's only a single DispatchWatcher, no need for a static mutex member
Change-Id: I410d07210bd80379fd2de1b8d76843794fa5f660
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index 3ba4e15..35864f1 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 13c5b25..a71c54b 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;
More information about the Libreoffice-commits
mailing list