diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-13 13:33:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-13 15:35:36 +0200 |
commit | 9753428dfc2bf038188c9a59af7fd2d789b46517 (patch) | |
tree | 923a3d1888dbadc38436de76b9cad343be5380fe /framework/source/uiconfiguration | |
parent | 53b8fcbd3f81903b171fd59478abf0283c6feb24 (diff) |
rtl::Static -> thread-safe static local
Change-Id: If5b7181fb1bb3f3f21ec3742680e5a3e12b21b73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120431
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/uiconfiguration')
-rw-r--r-- | framework/source/uiconfiguration/globalsettings.cxx | 13 | ||||
-rw-r--r-- | framework/source/uiconfiguration/imagemanagerimpl.cxx | 10 |
2 files changed, 3 insertions, 20 deletions
diff --git a/framework/source/uiconfiguration/globalsettings.cxx b/framework/source/uiconfiguration/globalsettings.cxx index 2727c2bb24cb..5efaa204274b 100644 --- a/framework/source/uiconfiguration/globalsettings.cxx +++ b/framework/source/uiconfiguration/globalsettings.cxx @@ -25,7 +25,6 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XEventListener.hpp> -#include <rtl/instance.hxx> #include <rtl/ref.hxx> #include <comphelper/propertysequence.hxx> #include <cppuhelper/implbase.hxx> @@ -222,19 +221,9 @@ void GlobalSettings_Access::impl_initConfigAccess() // global class -namespace { - -struct mutexGlobalSettings : public rtl::Static< osl::Mutex, mutexGlobalSettings > {}; - -} - -static rtl::Reference<GlobalSettings_Access> pStaticSettings; - static GlobalSettings_Access* GetGlobalSettings( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) { - osl::MutexGuard aGuard(mutexGlobalSettings::get()); - if ( !pStaticSettings ) - pStaticSettings = new GlobalSettings_Access( rxContext ); + static rtl::Reference<GlobalSettings_Access> pStaticSettings = new GlobalSettings_Access( rxContext ); return pStaticSettings.get(); } diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index 04ec4db065e1..f479063b4bfc 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -44,7 +44,6 @@ #include <unotools/ucbstreamhelper.hxx> #include <vcl/filter/PngImageReader.hxx> #include <vcl/pngwrite.hxx> -#include <rtl/instance.hxx> #include <memory> using ::com::sun::star::uno::Sequence; @@ -86,15 +85,10 @@ namespace framework static GlobalImageList* pGlobalImageList = nullptr; -namespace -{ - class theGlobalImageListMutex - : public rtl::Static<osl::Mutex, theGlobalImageListMutex> {}; -} - static osl::Mutex& getGlobalImageListMutex() { - return theGlobalImageListMutex::get(); + static osl::Mutex mutex; + return mutex; } static GlobalImageList* getGlobalImageList( const uno::Reference< uno::XComponentContext >& rxContext ) |