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 | 867a8eb32e0f75ec495ac5c4ee40c2adf905f5bc (patch) | |
tree | 5e8c10c58b342f823f448b58e5d8a405e291a0ed /sfx2 | |
parent | b2091208c8efdff44d6a331424de9662e94d9dc1 (diff) |
make this a non-leaky singleton
Diffstat (limited to 'sfx2')
-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 8f5cf0b055..fb89ea4cdb 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: */ |