diff options
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/dispatchwatcher.cxx | 15 | ||||
-rw-r--r-- | desktop/source/app/dispatchwatcher.hxx | 2 |
2 files changed, 6 insertions, 11 deletions
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index a04a1605db1f..28182d7e0db6 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -63,6 +63,7 @@ #include <vector> #include <osl/thread.hxx> +#include <rtl/instance.hxx> using ::rtl::OUString; using namespace ::osl; @@ -122,18 +123,14 @@ static OUString impl_GuessFilter( OUString aUrlIn, OUString aUrlOut ) return impl_GetFilterFromExt( aUrlOut, SFX_FILTER_EXPORT, aAppl ); } -Mutex* DispatchWatcher::pWatcherMutex = NULL; +namespace +{ + class theWatcherMutex : public rtl::Static<Mutex, theWatcherMutex> {}; +} Mutex& DispatchWatcher::GetMutex() { - if ( !pWatcherMutex ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pWatcherMutex ) - pWatcherMutex = new osl::Mutex(); - } - - return *pWatcherMutex; + return theWatcherMutex::get(); } // Create or get the dispatch watcher implementation. This implementation must be diff --git a/desktop/source/app/dispatchwatcher.hxx b/desktop/source/app/dispatchwatcher.hxx index 0fde60da603f..7146a29b3fd2 100644 --- a/desktop/source/app/dispatchwatcher.hxx +++ b/desktop/source/app/dispatchwatcher.hxx @@ -118,8 +118,6 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame: DispatchWatcherHashMap m_aRequestContainer; - static ::osl::Mutex* pWatcherMutex; - sal_Int16 m_nRequestCount; }; |