Kaydet (Commit) f8853c9f authored tarafından Caolán McNamara's avatar Caolán McNamara

valgrind: use non-leaky singleton pattern here

üst 3eaec7a8
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#include <vector> #include <vector>
#include <osl/thread.hxx> #include <osl/thread.hxx>
#include <rtl/instance.hxx>
using ::rtl::OUString; using ::rtl::OUString;
using namespace ::osl; using namespace ::osl;
...@@ -122,18 +123,14 @@ static OUString impl_GuessFilter( OUString aUrlIn, OUString aUrlOut ) ...@@ -122,18 +123,14 @@ static OUString impl_GuessFilter( OUString aUrlIn, OUString aUrlOut )
return impl_GetFilterFromExt( aUrlOut, SFX_FILTER_EXPORT, aAppl ); return impl_GetFilterFromExt( aUrlOut, SFX_FILTER_EXPORT, aAppl );
} }
Mutex* DispatchWatcher::pWatcherMutex = NULL; namespace
{
class theWatcherMutex : public rtl::Static<Mutex, theWatcherMutex> {};
}
Mutex& DispatchWatcher::GetMutex() Mutex& DispatchWatcher::GetMutex()
{ {
if ( !pWatcherMutex ) return theWatcherMutex::get();
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if ( !pWatcherMutex )
pWatcherMutex = new osl::Mutex();
}
return *pWatcherMutex;
} }
// Create or get the dispatch watcher implementation. This implementation must be // Create or get the dispatch watcher implementation. This implementation must be
......
...@@ -118,8 +118,6 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame: ...@@ -118,8 +118,6 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame:
DispatchWatcherHashMap m_aRequestContainer; DispatchWatcherHashMap m_aRequestContainer;
static ::osl::Mutex* pWatcherMutex;
sal_Int16 m_nRequestCount; sal_Int16 m_nRequestCount;
}; };
......
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