summaryrefslogtreecommitdiffstats
path: root/unotools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-11 21:52:01 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-12 11:51:10 +0100
commit3bc03cd0c10a74d929f21e84772416c9ee300c70 (patch)
treecf300a37ba3255a53ef5515f0f4cedcabc7db8c5 /unotools
parentshrink api further (diff)
downloadcore-3bc03cd0c10a74d929f21e84772416c9ee300c70.tar.gz
core-3bc03cd0c10a74d929f21e84772416c9ee300c70.zip
SvtFilterOptions::Get can never be NULL, return ref and don't leak
Diffstat (limited to 'unotools')
-rw-r--r--unotools/inc/unotools/fltrcfg.hxx5
-rw-r--r--unotools/source/config/fltrcfg.cxx17
2 files changed, 12 insertions, 10 deletions
diff --git a/unotools/inc/unotools/fltrcfg.hxx b/unotools/inc/unotools/fltrcfg.hxx
index e601804e6c53..cd581e6544fd 100644
--- a/unotools/inc/unotools/fltrcfg.hxx
+++ b/unotools/inc/unotools/fltrcfg.hxx
@@ -93,12 +93,9 @@ public:
sal_Bool IsEnableCalcPreview() const;
sal_Bool IsEnableWordPreview() const;
- static SvtFilterOptions* Get();
+ static SvtFilterOptions& Get();
};
#endif
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx
index 805a38f98620..5434ea569e5e 100644
--- a/unotools/source/config/fltrcfg.cxx
+++ b/unotools/source/config/fltrcfg.cxx
@@ -65,8 +65,6 @@ using ::rtl::OUString;
#define FILTERCFG_USE_ENHANCED_FIELDS 0x100000
#define FILTERCFG_WORD_WBCTBL 0x200000
-static SvtFilterOptions* pOptions=0;
-
class SvtAppFilterOptions_Impl : public utl::ConfigItem
{
sal_Bool bLoadVBA;
@@ -321,6 +319,7 @@ SvtFilterOptions::SvtFilterOptions() :
EnableNotification(GetPropertyNames());
Load();
}
+
// -----------------------------------------------------------------------
SvtFilterOptions::~SvtFilterOptions()
{
@@ -621,11 +620,17 @@ void SvtFilterOptions::SetImpress2PowerPoint( sal_Bool bFlag )
SetModified();
}
-SvtFilterOptions* SvtFilterOptions::Get()
+namespace
+{
+ class theFilterOptions
+ : public rtl::Static<SvtFilterOptions, theFilterOptions>
+ {
+ };
+}
+
+SvtFilterOptions& SvtFilterOptions::Get()
{
- if ( !pOptions )
- pOptions = new SvtFilterOptions;
- return pOptions;
+ return theFilterOptions::get();
}
// -----------------------------------------------------------------------