summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-05-16 22:24:54 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-05-20 15:23:39 +0100
commit9d8d7ac31151c5243a89d9e4739e5b4d61e7da0d (patch)
treed7833913b8b8e7892a4ffcbe18c9314eff20e1c7 /unotools
parentf1d6f81ad91366c617e97155b0aa325147090ba2 (diff)
non leaky singleton
Diffstat (limited to 'unotools')
-rw-r--r--unotools/inc/unotools/fontcfg.hxx2
-rw-r--r--unotools/source/config/fontcfg.cxx9
-rw-r--r--unotools/source/misc/fontdefs.cxx2
3 files changed, 5 insertions, 8 deletions
diff --git a/unotools/inc/unotools/fontcfg.hxx b/unotools/inc/unotools/fontcfg.hxx
index d370350484c1..6c2295805afd 100644
--- a/unotools/inc/unotools/fontcfg.hxx
+++ b/unotools/inc/unotools/fontcfg.hxx
@@ -211,7 +211,7 @@ private:
public:
~FontSubstConfiguration();
- static FontSubstConfiguration* get();
+ static FontSubstConfiguration& get();
const FontNameAttr* getSubstInfo(
const String& rFontName,
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index 6ff32c0b6e71..c3dc28acf079 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -61,8 +61,6 @@ using ::rtl::OUString;
static DefaultFontConfiguration* mpDefaultFontConfiguration = 0;
-static FontSubstConfiguration* mpFontSubstConfiguration = 0;
-
/*
* DefaultFontConfiguration
*/
@@ -375,11 +373,10 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale )
* FontSubstConfigItem::get
*/
-FontSubstConfiguration* FontSubstConfiguration::get()
+FontSubstConfiguration& FontSubstConfiguration::get()
{
- if( !mpFontSubstConfiguration )
- mpFontSubstConfiguration = new FontSubstConfiguration();
- return mpFontSubstConfiguration;
+ static FontSubstConfiguration aFontSubstConfiguration;
+ return aFontSubstConfiguration;
}
/*
diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index c89427dd27a2..d51c30ec7f58 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -542,7 +542,7 @@ String GetSubsFontName( const String& rName, sal_uLong nFlags )
|| aOrgName.EqualsAscii( "opensymbol" ) ) )
return aName;
- const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get()->getSubstInfo( aOrgName );
+ const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get().getSubstInfo( aOrgName );
if ( pAttr )
{
for( int i = 0; i < 3; i++ )