ucb/source/ucp/file/prov.cxx                     |    9 +++++----
 ucb/source/ucp/file/prov.hxx                     |    2 +-
 ucb/source/ucp/hierarchy/hierarchydatasource.cxx |   19 ++++++++-----------
 3 files changed, 14 insertions(+), 16 deletions(-)

New commits:
commit 30f437f4fc21ec83a597432a15e0ab570252a93d
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Oct 1 19:30:00 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Oct 2 09:38:24 2024 +0200

    cid#1556822 Data race condition
    
    and
    cid#1555688 Data race condition
    cid#1554983 Data race condition
    
    Change-Id: Iea24c9567de33aeaa519bc6b832ff1338b6d67be
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174362
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx
index 77e7772db7e2..40484c5d9a3c 100644
--- a/ucb/source/ucp/file/prov.cxx
+++ b/ucb/source/ucp/file/prov.cxx
@@ -300,9 +300,8 @@ XPropertySetInfoImpl2::hasPropertyByName(
 }
 
 
-void FileProvider::initProperties()
+void FileProvider::initProperties(std::unique_lock<std::mutex>& /*rGuard*/)
 {
-    std::scoped_lock aGuard( m_aMutex );
     if(  m_xPropertySetInfo.is() )
         return;
 
@@ -332,7 +331,8 @@ void FileProvider::initProperties()
 Reference< XPropertySetInfo > SAL_CALL
 FileProvider::getPropertySetInfo(  )
 {
-    initProperties();
+    std::unique_lock aGuard( m_aMutex );
+    initProperties(aGuard);
     return m_xPropertySetInfo;
 }
 
@@ -352,7 +352,8 @@ Any SAL_CALL
 FileProvider::getPropertyValue(
     const OUString& aPropertyName )
 {
-    initProperties();
+    std::unique_lock aGuard( m_aMutex );
+    initProperties(aGuard);
     if( aPropertyName == "FileSystemNotation" )
     {
         return Any(m_FileSystemNotation);
diff --git a/ucb/source/ucp/file/prov.hxx b/ucb/source/ucp/file/prov.hxx
index 311c1be0e469..3d1f9d7f63a0 100644
--- a/ucb/source/ucp/file/prov.hxx
+++ b/ucb/source/ucp/file/prov.hxx
@@ -143,7 +143,7 @@ namespace fileaccess {
         // Members
         css::uno::Reference< css::uno::XComponentContext >      m_xContext;
 
-        void initProperties();
+        void initProperties(std::unique_lock<std::mutex>& rGuard);
         std::mutex   m_aMutex;
         OUString m_HostName;
         OUString m_HomeDirectory;
commit 187728c38a654e1505d976524899d66fca37e993
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Oct 1 19:26:40 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Oct 2 09:38:15 2024 +0200

    cid#1607345 Data race condition
    
    Change-Id: I30798e5bfc6182e1b436c5116b49b7a4ae2328ae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174361
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx 
b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
index cb7b52fb119d..b30f6cd55a44 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
@@ -410,20 +410,17 @@ HierarchyDataSource::createInstanceWithArguments(
 uno::Reference< lang::XMultiServiceFactory >
 HierarchyDataSource::getConfigProvider()
 {
+    std::unique_lock aGuard( m_aMutex );
     if ( !m_xConfigProvider.is() )
     {
-        std::unique_lock aGuard( m_aMutex );
-        if ( !m_xConfigProvider.is() )
+        try
         {
-            try
-            {
-                m_xConfigProvider = configuration::theDefaultProvider::get( 
m_xContext );
-            }
-            catch ( uno::Exception const & )
-            {
-                OSL_FAIL( "HierarchyDataSource::getConfigProvider - "
-                               "caught exception!" );
-            }
+            m_xConfigProvider = configuration::theDefaultProvider::get( 
m_xContext );
+        }
+        catch ( uno::Exception const & )
+        {
+            OSL_FAIL( "HierarchyDataSource::getConfigProvider - "
+                           "caught exception!" );
         }
     }
 

Reply via email to