unotools/source/config/pathoptions.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit f5ba1d0aa5850d5c2a2e267c89ad60885144ae28
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Thu Dec 23 19:39:49 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Dec 25 09:28:23 2021 +0100

    osl::Mutex->std::mutex in SvtPathOptions
    
    Change-Id: Ibf0aef2116e6ee7ab1cdc0de2b2bb502a8ce05e1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127417
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/unotools/source/config/pathoptions.cxx 
b/unotools/source/config/pathoptions.cxx
index e7793d07321c..27ddbed79c24 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -434,9 +434,9 @@ SvtPathOptions_Impl::SvtPathOptions_Impl()
 
 namespace
 {
-    ::osl::Mutex& lclMutex()
+    std::mutex& lclMutex()
     {
-        static ::osl::Mutex SINGLETON;
+        static std::mutex SINGLETON;
         return SINGLETON;
     }
 }
@@ -444,12 +444,13 @@ namespace
 SvtPathOptions::SvtPathOptions()
 {
     // Global access, must be guarded (multithreading)
-    ::osl::MutexGuard aGuard( lclMutex() );
+    std::unique_lock aGuard( lclMutex() );
     pImpl = g_pOptions.lock();
     if ( !pImpl )
     {
         pImpl = std::make_shared<SvtPathOptions_Impl>();
         g_pOptions = pImpl;
+        aGuard.unlock(); // because holdConfigItem will call this constructor
         ItemHolder1::holdConfigItem(EItem::PathOptions);
     }
 }
@@ -457,7 +458,7 @@ SvtPathOptions::SvtPathOptions()
 SvtPathOptions::~SvtPathOptions()
 {
     // Global access, must be guarded (multithreading)
-    ::osl::MutexGuard aGuard( lclMutex() );
+    std::unique_lock aGuard( lclMutex() );
 
     pImpl.reset();
 }

Reply via email to