valgrind: use non-leaky singleton pattern here
This commit is contained in:
parent
3eaec7a874
commit
f8853c9f4e
2 changed files with 6 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -118,8 +118,6 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame:
|
|||
|
||||
DispatchWatcherHashMap m_aRequestContainer;
|
||||
|
||||
static ::osl::Mutex* pWatcherMutex;
|
||||
|
||||
sal_Int16 m_nRequestCount;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue