[Libreoffice-commits] core.git: basic/source

Arnaud Versini (via logerrit) logerrit at kemper.freedesktop.org
Sun Mar 7 12:37:57 UTC 2021


 basic/source/classes/errobject.cxx |    8 ++++++--
 basic/source/runtime/basrdll.cxx   |   10 ++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 08cb09c092f503c43d93b9e8c816dd5412d2d917
Author:     Arnaud Versini <arnaud.versini at libreoffice.org>
AuthorDate: Sun Jan 3 12:49:37 2021 +0100
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Mar 7 13:37:19 2021 +0100

    BASIC : use standard mutex from std.
    
    Change-Id: Ie9abb32124b8718bbfde076f090180794c64f90e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108629
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/basic/source/classes/errobject.cxx b/basic/source/classes/errobject.cxx
index b961e16983f7..85423101b827 100644
--- a/basic/source/classes/errobject.cxx
+++ b/basic/source/classes/errobject.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <mutex>
+
 #include <errobject.hxx>
 #include <sbxbase.hxx>
 
@@ -195,8 +199,8 @@ SbxErrObject::getErrObject()
 {
     SbxVariableRef& rGlobErr = GetSbxData_Impl().m_aGlobErr;
     {
-        static osl::Mutex aMutex;
-        osl::MutexGuard aGuard(aMutex);
+        static std::mutex aMutex;
+        std::scoped_lock aGuard(aMutex);
         if (!rGlobErr)
             rGlobErr = new SbxErrObject("Err",
                                         uno::Any(uno::Reference<vba::XErrObject>(new ErrObject())));
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index 29cd292e2bdf..ba94fd7b9d2b 100644
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -18,6 +18,8 @@
  */
 
 #include <memory>
+#include <mutex>
+
 #include <vcl/svapp.hxx>
 #include <tools/debug.hxx>
 #include <vcl/weld.hxx>
@@ -44,9 +46,9 @@ struct BasicDLLImpl : public SvRefBase
     { }
 
     static BasicDLLImpl* BASIC_DLL;
-    static osl::Mutex& getMutex()
+    static std::mutex& getMutex()
     {
-        static osl::Mutex aMutex;
+        static std::mutex aMutex;
         return aMutex;
     }
 };
@@ -56,7 +58,7 @@ BasicDLLImpl* BasicDLLImpl::BASIC_DLL = nullptr;
 
 BasicDLL::BasicDLL()
 {
-    osl::MutexGuard aGuard(BasicDLLImpl::getMutex());
+    std::scoped_lock aGuard(BasicDLLImpl::getMutex());
     if (!BasicDLLImpl::BASIC_DLL)
         BasicDLLImpl::BASIC_DLL = new BasicDLLImpl;
     m_xImpl = BasicDLLImpl::BASIC_DLL;
@@ -64,7 +66,7 @@ BasicDLL::BasicDLL()
 
 BasicDLL::~BasicDLL()
 {
-    osl::MutexGuard aGuard(BasicDLLImpl::getMutex());
+    std::scoped_lock aGuard(BasicDLLImpl::getMutex());
     const bool bLastRef = m_xImpl->GetRefCount() == 1;
     if (bLastRef) {
         BasicDLLImpl::BASIC_DLL->xSbxAppData->m_aGlobErr.clear();


More information about the Libreoffice-commits mailing list