summaryrefslogtreecommitdiff
path: root/framework/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-05-20 20:52:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-05-23 12:31:12 +0100
commit87441058ea4282ac98a6bd4568f28b2d2c5af895 (patch)
treef3b0762b362d91050267c8df7478a44408100bb5 /framework/source
parentbca6c6d26764a919ad1df36e4f636963f9b9324a (diff)
convert to non-leaky singleton
Diffstat (limited to 'framework/source')
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.cxx19
1 files changed, 9 insertions, 10 deletions
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 9b780b9d86cb..9e2ec124f77b 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -61,7 +61,8 @@
#include <vcl/pngread.hxx>
#include <vcl/pngwrite.hxx>
#include <rtl/logfile.hxx>
-#include "svtools/miscopt.hxx"
+#include <rtl/instance.hxx>
+#include <svtools/miscopt.hxx>
using ::rtl::OUString;
using ::com::sun::star::uno::Sequence;
@@ -105,7 +106,6 @@ static const char* BITMAP_FILE_NAMES[] =
namespace framework
{
static char ModuleImageList[] = "private:resource/images/moduleimages";
- static osl::Mutex* pImageListWrapperMutex = 0;
static GlobalImageList* pGlobalImageList = 0;
static const char* ImageType_Prefixes[ImageType_COUNT] =
{
@@ -115,16 +115,15 @@ namespace framework
typedef GraphicNameAccess CmdToXGraphicNameAccess;
-static osl::Mutex& getGlobalImageListMutex()
+namespace
{
- if ( pImageListWrapperMutex == 0 )
- {
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
- if ( pImageListWrapperMutex == 0 )
- pImageListWrapperMutex = new osl::Mutex;
- }
+ class theGlobalImageListMutex
+ : public rtl::Static<osl::Mutex, theGlobalImageListMutex> {};
+}
- return *pImageListWrapperMutex;
+static osl::Mutex& getGlobalImageListMutex()
+{
+ return theGlobalImageListMutex::get();
}
static GlobalImageList* getGlobalImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager )