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

convert to non-leaky singleton

üst bca6c6d2
...@@ -61,7 +61,8 @@ ...@@ -61,7 +61,8 @@
#include <vcl/pngread.hxx> #include <vcl/pngread.hxx>
#include <vcl/pngwrite.hxx> #include <vcl/pngwrite.hxx>
#include <rtl/logfile.hxx> #include <rtl/logfile.hxx>
#include "svtools/miscopt.hxx" #include <rtl/instance.hxx>
#include <svtools/miscopt.hxx>
using ::rtl::OUString; using ::rtl::OUString;
using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Sequence;
...@@ -105,7 +106,6 @@ static const char* BITMAP_FILE_NAMES[] = ...@@ -105,7 +106,6 @@ static const char* BITMAP_FILE_NAMES[] =
namespace framework namespace framework
{ {
static char ModuleImageList[] = "private:resource/images/moduleimages"; static char ModuleImageList[] = "private:resource/images/moduleimages";
static osl::Mutex* pImageListWrapperMutex = 0;
static GlobalImageList* pGlobalImageList = 0; static GlobalImageList* pGlobalImageList = 0;
static const char* ImageType_Prefixes[ImageType_COUNT] = static const char* ImageType_Prefixes[ImageType_COUNT] =
{ {
...@@ -115,16 +115,15 @@ namespace framework ...@@ -115,16 +115,15 @@ namespace framework
typedef GraphicNameAccess CmdToXGraphicNameAccess; typedef GraphicNameAccess CmdToXGraphicNameAccess;
static osl::Mutex& getGlobalImageListMutex() namespace
{ {
if ( pImageListWrapperMutex == 0 ) class theGlobalImageListMutex
{ : public rtl::Static<osl::Mutex, theGlobalImageListMutex> {};
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; }
if ( pImageListWrapperMutex == 0 )
pImageListWrapperMutex = new osl::Mutex;
}
return *pImageListWrapperMutex; static osl::Mutex& getGlobalImageListMutex()
{
return theGlobalImageListMutex::get();
} }
static GlobalImageList* getGlobalImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager ) static GlobalImageList* getGlobalImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager )
......
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