diff options
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/syslocaleoptions.cxx | 19 | ||||
-rw-r--r-- | unotools/source/misc/syslocale.cxx | 19 |
2 files changed, 12 insertions, 26 deletions
diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx index 1bfb1be81109..ed1675ffaed1 100644 --- a/unotools/source/config/syslocaleoptions.cxx +++ b/unotools/source/config/syslocaleoptions.cxx @@ -523,19 +523,12 @@ SvtSysLocaleOptions::~SvtSysLocaleOptions() // static Mutex& SvtSysLocaleOptions::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; } bool SvtSysLocaleOptions::IsModified() 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 |