summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-05-16 22:26:06 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-05-20 15:23:39 +0100
commit63a8d58ef8fa7c59e6aff755e6546e725b513f39 (patch)
treed94d2d889fdcc57b123b1da4b1f2f437c69c304e /unotools
parent9d8d7ac31151c5243a89d9e4739e5b4d61e7da0d (diff)
non leaky singleton
Diffstat (limited to 'unotools')
-rw-r--r--unotools/inc/unotools/fontcfg.hxx2
-rw-r--r--unotools/source/config/fontcfg.cxx9
2 files changed, 4 insertions, 7 deletions
diff --git a/unotools/inc/unotools/fontcfg.hxx b/unotools/inc/unotools/fontcfg.hxx
index 6c2295805afd..136147a095d4 100644
--- a/unotools/inc/unotools/fontcfg.hxx
+++ b/unotools/inc/unotools/fontcfg.hxx
@@ -97,7 +97,7 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration
public:
~DefaultFontConfiguration();
- static DefaultFontConfiguration* get();
+ static DefaultFontConfiguration& get();
rtl::OUString getDefaultFont( const com::sun::star::lang::Locale& rLocale, int nType ) const;
rtl::OUString getUserInterfaceFont( const com::sun::star::lang::Locale& rLocale ) const;
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index c3dc28acf079..5786e96af8cc 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -59,8 +59,6 @@ using namespace com::sun::star::container;
using ::rtl::OUString;
-static DefaultFontConfiguration* mpDefaultFontConfiguration = 0;
-
/*
* DefaultFontConfiguration
*/
@@ -98,11 +96,10 @@ static const char* getKeyType( int nKeyType )
}
}
-DefaultFontConfiguration* DefaultFontConfiguration::get()
+DefaultFontConfiguration& DefaultFontConfiguration::get()
{
- if( !mpDefaultFontConfiguration )
- mpDefaultFontConfiguration = new DefaultFontConfiguration();
- return mpDefaultFontConfiguration;
+ static DefaultFontConfiguration aDefaultFontConfiguration;
+ return aDefaultFontConfiguration;
}
DefaultFontConfiguration::DefaultFontConfiguration()