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

valgrind: use non-leaky singleton pattern here

üst c3f4ddfc
...@@ -50,7 +50,8 @@ ...@@ -50,7 +50,8 @@
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <osl/file.hxx> #include <osl/file.hxx>
#include "rtl/process.h" #include <rtl/process.h>
#include <rtl/instance.hxx>
#include "tools/getprocessworkingdir.hxx" #include "tools/getprocessworkingdir.hxx"
using namespace desktop; using namespace desktop;
...@@ -223,7 +224,6 @@ bool addArgument( ...@@ -223,7 +224,6 @@ bool addArgument(
OfficeIPCThread* OfficeIPCThread::pGlobalOfficeIPCThread = 0; OfficeIPCThread* OfficeIPCThread::pGlobalOfficeIPCThread = 0;
namespace { struct Security : public rtl::Static<osl::Security, Security> {}; } namespace { struct Security : public rtl::Static<osl::Security, Security> {}; }
::osl::Mutex* OfficeIPCThread::pOfficeIPCThreadMutex = 0;
// Turns a string in aMsg such as file:///home/foo/.libreoffice/3 // Turns a string in aMsg such as file:///home/foo/.libreoffice/3
// Into a hex string of well known length ff132a86... // Into a hex string of well known length ff132a86...
...@@ -360,19 +360,15 @@ throw( RuntimeException ) ...@@ -360,19 +360,15 @@ throw( RuntimeException )
{ {
} }
// ---------------------------------------------------------------------------- namespace
{
class theOfficeIPCThreadMutex
: public rtl::Static<osl::Mutex, theOfficeIPCThreadMutex> {};
}
::osl::Mutex& OfficeIPCThread::GetMutex() ::osl::Mutex& OfficeIPCThread::GetMutex()
{ {
// Get or create our mutex for thread-saftey return theOfficeIPCThreadMutex::get();
if ( !pOfficeIPCThreadMutex )
{
::osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
if ( !pOfficeIPCThreadMutex )
pOfficeIPCThreadMutex = new osl::Mutex;
}
return *pOfficeIPCThreadMutex;
} }
void OfficeIPCThread::SetDowning() void OfficeIPCThread::SetDowning()
......
...@@ -74,7 +74,6 @@ class OfficeIPCThread : public osl::Thread ...@@ -74,7 +74,6 @@ class OfficeIPCThread : public osl::Thread
{ {
private: private:
static OfficeIPCThread* pGlobalOfficeIPCThread; static OfficeIPCThread* pGlobalOfficeIPCThread;
static ::osl::Mutex* pOfficeIPCThreadMutex;
osl::Pipe maPipe; osl::Pipe maPipe;
osl::StreamPipe maStreamPipe; osl::StreamPipe maStreamPipe;
......
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