diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-11-17 20:27:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-18 14:16:40 +0100 |
commit | 4d45eacd5485a756584fc7edecce8c821d4b7123 (patch) | |
tree | 40787c7eeec0c5a9c2992e2430dd987f07c54e15 /sfx2 | |
parent | a478ac0f0a1eda92d35477462f70412bc65f9d36 (diff) |
rtl::Static->thread-safe static in sfx2
Change-Id: I8074494094f561c5ff21d13c68430798dc242604
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125423
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/app.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/appl/sfxpicklist.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/bastyp/fltfnc.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 1 |
4 files changed, 4 insertions, 26 deletions
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 83c59e708872..42144afc33e8 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -54,7 +54,6 @@ #include <officecfg/Office/Common.hxx> #include <unotools/viewoptions.hxx> -#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <memory> #include <framework/sfxhelperfunctions.hxx> @@ -70,12 +69,6 @@ static SfxApplication* g_pSfxApplication = nullptr; static SfxHelp* pSfxHelp = nullptr; #endif -namespace -{ - class theApplicationMutex - : public rtl::Static<osl::Mutex, theApplicationMutex> {}; -} - SfxApplication* SfxApplication::Get() { return g_pSfxApplication; @@ -107,8 +100,10 @@ namespace { SfxApplication* SfxApplication::GetOrCreate() { + static osl::Mutex theApplicationMutex; + // SFX on demand - ::osl::MutexGuard aGuard(theApplicationMutex::get()); + ::osl::MutexGuard aGuard(theApplicationMutex); if (!g_pSfxApplication) { SAL_INFO( "sfx.appl", "SfxApplication::SetApp" ); diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index ea7f460fc403..83834597aff0 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -40,20 +40,11 @@ #include <sfx2/docfilt.hxx> #include <sfx2/viewfrm.hxx> -#include <rtl/instance.hxx> - using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::util; - -namespace -{ - class thePickListMutex - : public rtl::Static<osl::Mutex, thePickListMutex> {}; -} - class SfxPickListImpl : public SfxListener { /** diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 5aa4cb57a688..fd2e7c2df31d 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -47,8 +47,6 @@ #include <unotools/mediadescriptor.hxx> #include <tools/urlobj.hxx> -#include <rtl/instance.hxx> - #include <unotools/syslocale.hxx> #include <unotools/charclass.hxx> @@ -72,11 +70,6 @@ unsigned SfxStack::nLevel = 0; using namespace com::sun::star; -namespace -{ - class theSfxFilterListener : public rtl::Static<SfxFilterListener, theSfxFilterListener> {}; -} - static SfxFilterList_Impl* pFilterArr = nullptr; static bool bFirstRead = true; @@ -84,7 +77,7 @@ static void CreateFilterArr() { static SfxFilterList_Impl theSfxFilterArray; pFilterArr = &theSfxFilterArray; - theSfxFilterListener::get(); + static SfxFilterListener theSfxFilterListener; } static OUString ToUpper_Impl( const OUString &rStr ) diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 73ab44f1da9f..fb6cca399cec 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -32,7 +32,6 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <osl/file.hxx> -#include <rtl/instance.hxx> #include <sal/log.hxx> #include <vcl/weld.hxx> #include <vcl/svapp.hxx> |