summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-06-17 14:01:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-17 15:43:38 +0200
commit6149da20ddee5c0c50b445fb6a4e3e81b5ff900b (patch)
tree7cfca9c16dff522f0c0e15809f9fe4b926078698 /svl
parent470752f50c146b449b1c9bdccc36ed031535663c (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 'svl')
-rw-r--r--svl/source/numbers/zforlist.cxx19
1 files changed, 6 insertions, 13 deletions
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 876dfbde187e..1b77382bc6bd 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -350,19 +350,12 @@ void SvNumberFormatter::ChangeIntl(LanguageType eLnge)
// static
::osl::Mutex& SvNumberFormatter::GetMutex()
{
- static ::osl::Mutex* pMutex = nullptr;
- if( !pMutex )
- {
- ::osl::MutexGuard aGuard( ::osl::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 ::osl::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 ::osl::Mutex persistantMutex;
+
+ return persistantMutex;
}