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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 31 18:13:43 UTC 2021


 sax/source/fastparser/fastparser.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit f146cb69eb2a2cc0bffb0e76dbccbcdf942d5f7e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 31 18:31:25 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 31 20:13:09 2021 +0200

    osl::Mutex->std::mutex in Entity
    
    Change-Id: Ia9201dc4998a592ef4adaa39666f67a0935e8161
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119745
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index aa3bb66c18f8..980c092c796e 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -40,6 +40,7 @@
 
 #include <queue>
 #include <memory>
+#include <mutex>
 #include <stack>
 #include <string_view>
 #include <unordered_map>
@@ -173,7 +174,7 @@ struct Entity : public ParserData
     // resource leaks), therefore any exception thrown by a UNO callback
     // must be saved somewhere until the C-XmlParser is stopped.
     css::uno::Any                           maSavedException;
-    osl::Mutex maSavedExceptionMutex;
+    std::mutex                              maSavedExceptionMutex;
     void saveException( const Any & e );
     // Thread-safe check if maSavedException has value
     bool hasException();
@@ -600,7 +601,7 @@ void Entity::throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumen
     // Error during parsing !
     Any savedException;
     {
-        osl::MutexGuard g(maSavedExceptionMutex);
+        std::lock_guard g(maSavedExceptionMutex);
         if (maSavedException.hasValue())
         {
             savedException.setValue(&maSavedException, cppu::UnoType<decltype(maSavedException)>::get());
@@ -642,7 +643,7 @@ void Entity::saveException( const Any & e )
     // unexpectedly some 'startElements' produce a UNO_QUERY_THROW
     // for XComponent; and yet expect to continue parsing.
     SAL_WARN("sax", "Unexpected exception from XML parser " << exceptionToString(e));
-    osl::MutexGuard g(maSavedExceptionMutex);
+    std::lock_guard g(maSavedExceptionMutex);
     if (maSavedException.hasValue())
     {
         SAL_INFO("sax.fastparser", "discarding exception, already have one");
@@ -655,7 +656,7 @@ void Entity::saveException( const Any & e )
 
 bool Entity::hasException()
 {
-    osl::MutexGuard g(maSavedExceptionMutex);
+    std::lock_guard g(maSavedExceptionMutex);
     return maSavedException.hasValue();
 }
 


More information about the Libreoffice-commits mailing list