summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-05-20 23:03:34 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-05-23 12:31:12 +0100
commitec1b60d6df9339365723839a9108fb5101bcb797 (patch)
treeb75a648a2580da77dff485fbe9841519c84abeb7 /sfx2
parentfeeab468729a3ceea6fdeb74f0056ec551bcb742 (diff)
make this a non-leaky singleton
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/docfac.hxx14
1 files changed, 5 insertions, 9 deletions
diff --git a/sfx2/inc/sfx2/docfac.hxx b/sfx2/inc/sfx2/docfac.hxx
index c1af3c52daca..b0a047c7180b 100644
--- a/sfx2/inc/sfx2/docfac.hxx
+++ b/sfx2/inc/sfx2/docfac.hxx
@@ -122,20 +122,16 @@ private:
//=========================================================================
#define SFX_DECL_OBJECTFACTORY() \
-private: \
- static SfxObjectFactory* pObjectFactory; \
public: \
static SfxObjectFactory& Factory(); \
virtual SfxObjectFactory& GetFactory() const { return Factory(); }
#define SFX_IMPL_OBJECTFACTORY(ClassName,GlobName,Flags,ShortName) \
- SfxObjectFactory* ClassName::pObjectFactory = 0; \
- SfxObjectFactory& ClassName::Factory() \
- { if (!pObjectFactory) \
- pObjectFactory = \
- new SfxObjectFactory( GlobName, Flags, ShortName ); \
- return *pObjectFactory; \
- }
+ SfxObjectFactory& ClassName::Factory() \
+ { \
+ static SfxObjectFactory aObjectFactory(GlobName, Flags, ShortName); \
+ return aObjectFactory; \
+ }
#endif // #ifndef _SFX_OBJFAC_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */