diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-06-17 14:01:36 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-17 15:43:38 +0200 |
commit | 6149da20ddee5c0c50b445fb6a4e3e81b5ff900b (patch) | |
tree | 7cfca9c16dff522f0c0e15809f9fe4b926078698 /unotools/source/misc | |
parent | 470752f50c146b449b1c9bdccc36ed031535663c (diff) |
replace misc double checked locking patterns
... with thread safe local statics
Change-Id: Ie3c8023776a388846b989f00a0be185273c0d5da
Reviewed-on: https://gerrit.libreoffice.org/38907
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools/source/misc')
-rw-r--r-- | unotools/source/misc/syslocale.cxx | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx index 0955090391a2..0dcecca29392 100644 --- a/unotools/source/misc/syslocale.cxx +++ b/unotools/source/misc/syslocale.cxx @@ -134,19 +134,12 @@ SvtSysLocale::~SvtSysLocale() // static Mutex& SvtSysLocale::GetMutex() { - static Mutex* pMutex = nullptr; - if( !pMutex ) - { - MutexGuard aGuard( Mutex::getGlobalMutex() ); - if( !pMutex ) - { - // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svl library. - // Otherwise the dtor would use a destructed mutex!! - pMutex = new Mutex; - } - } - return *pMutex; + // #i77768# Due to a static reference in the toolkit lib + // we need a mutex that lives longer than the svl library. + // Otherwise the dtor would use a destructed mutex!! + static Mutex persistentMutex; + + return persistentMutex; } const LocaleDataWrapper& SvtSysLocale::GetLocaleData() const |