diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-11-18 20:08:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-19 07:33:00 +0100 |
commit | 6f3c6b12eaf0466827c9ec6b84c2516e38061b04 (patch) | |
tree | 7cfc74a48d377cffa170277f52ef005b3740a9da | |
parent | 79db82976e3070b7889d2ec350dde3eff703ebe4 (diff) |
rtl::Static->thread-safe static in svx
Change-Id: I743d252befd948580a1b3619f51d3f0343cb469d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125493
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | svx/source/gallery2/galexpl.cxx | 11 | ||||
-rw-r--r-- | svx/source/items/svxerr.cxx | 9 | ||||
-rw-r--r-- | svx/source/sdr/attribute/sdrformtextattribute.cxx | 12 | ||||
-rw-r--r-- | svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx | 12 | ||||
-rw-r--r-- | svx/source/sdr/attribute/sdrtextattribute.cxx | 12 |
5 files changed, 29 insertions, 27 deletions
diff --git a/svx/source/gallery2/galexpl.cxx b/svx/source/gallery2/galexpl.cxx index 83dc3b1688dd..c155f4f14613 100644 --- a/svx/source/gallery2/galexpl.cxx +++ b/svx/source/gallery2/galexpl.cxx @@ -18,7 +18,6 @@ */ -#include <rtl/instance.hxx> #include <svx/gallery1.hxx> #include <svx/galtheme.hxx> #include <svx/gallery.hxx> @@ -26,7 +25,11 @@ namespace { - class theLockListener : public rtl::Static< SfxListener, theLockListener > {}; + SfxListener& theLockListener() + { + static SfxListener SINGLETON; + return SINGLETON; + } } @@ -240,7 +243,7 @@ bool GalleryExplorer::BeginLocking( std::u16string_view rThemeName ) if( pGal ) { - GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, theLockListener::get() ); + GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, theLockListener() ); if( pTheme ) { @@ -278,7 +281,7 @@ bool GalleryExplorer::EndLocking( std::u16string_view rThemeName ) if( bReleaseLockedTheme ) { // release locked theme - pGal->ReleaseTheme( pTheme, theLockListener::get() ); + pGal->ReleaseTheme( pTheme, theLockListener() ); bRet = true; } } diff --git a/svx/source/items/svxerr.cxx b/svx/source/items/svxerr.cxx index 4fd503c388d0..24efadda459e 100644 --- a/svx/source/items/svxerr.cxx +++ b/svx/source/items/svxerr.cxx @@ -19,7 +19,6 @@ #include <svx/svxerr.hxx> #include <svx/dialmgr.hxx> -#include <rtl/instance.hxx> #include <svxerr.hrc> SvxErrorHandler::SvxErrorHandler() : @@ -28,16 +27,10 @@ SvxErrorHandler::SvxErrorHandler() : { } -namespace -{ - class theSvxErrorHandler - : public rtl::Static<SvxErrorHandler, theSvxErrorHandler> {}; -} - void SvxErrorHandler::ensure() { + static SvxErrorHandler SINGLETON; // coverity[side_effect_free : FALSE] - not actually side-effect-free - theSvxErrorHandler::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx index cdec873b0d26..69fff8a8d724 100644 --- a/svx/source/sdr/attribute/sdrformtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx @@ -45,7 +45,6 @@ #include <sdr/attribute/sdrformtextoutlineattribute.hxx> #include <com/sun/star/drawing/LineCap.hpp> #include <com/sun/star/drawing/LineStyle.hpp> -#include <rtl/instance.hxx> // helper to get line, stroke and transparence attributes from SfxItemSet @@ -251,8 +250,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< SdrFormTextAttribute::ImplType, theGlobalDefault > {}; + SdrFormTextAttribute::ImplType& theGlobalDefault() + { + static SdrFormTextAttribute::ImplType SINGLETON; + return SINGLETON; + } } SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet) @@ -261,7 +263,7 @@ namespace drawinglayer::attribute } SdrFormTextAttribute::SdrFormTextAttribute() - : mpSdrFormTextAttribute(theGlobalDefault::get()) + : mpSdrFormTextAttribute(theGlobalDefault()) { } @@ -281,7 +283,7 @@ namespace drawinglayer::attribute bool SdrFormTextAttribute::isDefault() const { - return mpSdrFormTextAttribute.same_object(theGlobalDefault::get()); + return mpSdrFormTextAttribute.same_object(theGlobalDefault()); } SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate) diff --git a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx index 180f9bbfc928..ec97cf04429d 100644 --- a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx @@ -21,7 +21,6 @@ #include <sdr/attribute/sdrformtextoutlineattribute.hxx> #include <drawinglayer/attribute/lineattribute.hxx> #include <drawinglayer/attribute/strokeattribute.hxx> -#include <rtl/instance.hxx> namespace drawinglayer::attribute @@ -65,8 +64,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< SdrFormTextOutlineAttribute::ImplType, theGlobalDefault > {}; + SdrFormTextOutlineAttribute::ImplType& theGlobalDefault() + { + static SdrFormTextOutlineAttribute::ImplType SINGLETON; + return SINGLETON; + } } SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute( @@ -80,7 +82,7 @@ namespace drawinglayer::attribute } SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute() - : mpSdrFormTextOutlineAttribute(theGlobalDefault::get()) + : mpSdrFormTextOutlineAttribute(theGlobalDefault()) { } @@ -95,7 +97,7 @@ namespace drawinglayer::attribute bool SdrFormTextOutlineAttribute::isDefault() const { - return mpSdrFormTextOutlineAttribute.same_object(theGlobalDefault::get()); + return mpSdrFormTextOutlineAttribute.same_object(theGlobalDefault()); } SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(const SdrFormTextOutlineAttribute& rCandidate) diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index c9623a92498f..5c9ecb34ede2 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -23,7 +23,6 @@ #include <svx/svdotext.hxx> #include <editeng/outlobj.hxx> #include <svx/sdr/properties/properties.hxx> -#include <rtl/instance.hxx> namespace drawinglayer::attribute @@ -229,8 +228,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< SdrTextAttribute::ImplType, theGlobalDefault > {}; + SdrTextAttribute::ImplType& theGlobalDefault() + { + static SdrTextAttribute::ImplType SINGLETON; + return SINGLETON; + } } SdrTextAttribute::SdrTextAttribute( @@ -264,7 +266,7 @@ namespace drawinglayer::attribute } SdrTextAttribute::SdrTextAttribute() - : mpSdrTextAttribute(theGlobalDefault::get()) + : mpSdrTextAttribute(theGlobalDefault()) { } @@ -284,7 +286,7 @@ namespace drawinglayer::attribute bool SdrTextAttribute::isDefault() const { - return mpSdrTextAttribute.same_object(theGlobalDefault::get()); + return mpSdrTextAttribute.same_object(theGlobalDefault()); } SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate) |