diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-05-20 23:03:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-05-23 12:31:12 +0100 |
commit | ec1b60d6df9339365723839a9108fb5101bcb797 (patch) | |
tree | b75a648a2580da77dff485fbe9841519c84abeb7 /sfx2/inc | |
parent | feeab468729a3ceea6fdeb74f0056ec551bcb742 (diff) |
make this a non-leaky singleton
Diffstat (limited to 'sfx2/inc')
-rw-r--r-- | sfx2/inc/sfx2/docfac.hxx | 14 |
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: */ |