summaryrefslogtreecommitdiff
path: root/svtools/source/config/htmlcfg.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-05-10 16:14:56 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-05-20 15:23:38 +0100
commita1e2078b24132f086e94b85bf7a07d69ab191120 (patch)
treec46d441fa73c4f746a4ab906d07e414ec922c2cc /svtools/source/config/htmlcfg.cxx
parent93a28b0aced7f552f0f072c795f4301a2bad0d0e (diff)
config leaks: make this a well behaved singleton
Diffstat (limited to 'svtools/source/config/htmlcfg.cxx')
-rw-r--r--svtools/source/config/htmlcfg.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx
index c3d5526a41fa..338fd0d6e40c 100644
--- a/svtools/source/config/htmlcfg.cxx
+++ b/svtools/source/config/htmlcfg.cxx
@@ -35,6 +35,7 @@
#include <tools/debug.hxx>
#include <tools/link.hxx>
#include <sal/macros.h>
+#include <rtl/instance.hxx>
#include <list>
// -----------------------------------------------------------------------
@@ -53,8 +54,6 @@ using namespace com::sun::star::uno;
using ::rtl::OUString;
-static SvxHtmlOptions* pOptions = 0;
-
#define C2U(cChar) OUString::createFromAscii(cChar)
struct HtmlOptions_Impl
@@ -458,11 +457,14 @@ sal_Bool SvxHtmlOptions::IsDefaultTextEncoding() const
return pImp->bIsEncodingDefault;
}
-SvxHtmlOptions* SvxHtmlOptions::Get()
+namespace
+{
+ class theSvxHtmlOptions : public rtl::Static<SvxHtmlOptions, theSvxHtmlOptions> {};
+}
+
+SvxHtmlOptions& SvxHtmlOptions::Get()
{
- if ( !pOptions )
- pOptions = new SvxHtmlOptions;
- return pOptions;
+ return theSvxHtmlOptions::get();
}
sal_Bool SvxHtmlOptions::IsNumbersEnglishUS() const