From e7dbef922a2fc73469f12c520bcc1af54fe038fb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 23 Mar 2023 11:11:48 +0200 Subject: rtl::Static to thread-safe-static Change-Id: Ife02e6d2be3ebfbb08522ab0183ef4aa31a99e19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149415 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svl/source/config/ctloptions.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'svl') diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx index 38544f758a3a..288761bd9394 100644 --- a/svl/source/config/ctloptions.cxx +++ b/svl/source/config/ctloptions.cxx @@ -338,13 +338,17 @@ namespace { // global std::weak_ptr g_pCTLOptions; - struct CTLMutex : public rtl::Static< osl::Mutex, CTLMutex > {}; + osl::Mutex& CTLMutex() + { + static osl::Mutex aMutex; + return aMutex; + } } SvtCTLOptions::SvtCTLOptions( bool bDontLoad ) { // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( CTLMutex::get() ); + ::osl::MutexGuard aGuard( CTLMutex() ); m_pImpl = g_pCTLOptions.lock(); if ( !m_pImpl ) @@ -364,7 +368,7 @@ SvtCTLOptions::SvtCTLOptions( bool bDontLoad ) SvtCTLOptions::~SvtCTLOptions() { // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( CTLMutex::get() ); + ::osl::MutexGuard aGuard( CTLMutex() ); m_pImpl->RemoveListener(this); m_pImpl.reset(); -- cgit