svl/source/fsstor/ostreamcontainer.cxx |   40 ++++++++++++++-------------------
 1 file changed, 18 insertions(+), 22 deletions(-)

New commits:
commit e1e7a1ef0f4abc10a55cf9b093468ba6adf0505e
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Thu Oct 3 19:11:33 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Oct 5 08:57:43 2024 +0200

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

diff --git a/svl/source/fsstor/ostreamcontainer.cxx 
b/svl/source/fsstor/ostreamcontainer.cxx
index 53814285880e..78a168f04b49 100644
--- a/svl/source/fsstor/ostreamcontainer.cxx
+++ b/svl/source/fsstor/ostreamcontainer.cxx
@@ -135,31 +135,27 @@ void SAL_CALL OFSStreamContainer::release()
 //  XTypeProvider
 uno::Sequence< uno::Type > SAL_CALL OFSStreamContainer::getTypes()
 {
+    std::scoped_lock aGuard( m_aMutex );
     if ( !m_aTypes.hasElements() )
     {
-        std::scoped_lock aGuard( m_aMutex );
-
-        if ( !m_aTypes.hasElements() )
+        std::vector<uno::Type> tmp
         {
-            std::vector<uno::Type> tmp
-            {
-                cppu::UnoType<lang::XTypeProvider>::get(),
-                cppu::UnoType<embed::XExtendedStorageStream>::get()
-            };
-
-            if ( m_xSeekable.is() )
-                tmp.push_back(cppu::UnoType<io::XSeekable>::get());
-            if ( m_xInputStream.is() )
-                tmp.push_back(cppu::UnoType<io::XInputStream>::get());
-            if ( m_xOutputStream.is() )
-                tmp.push_back(cppu::UnoType<io::XOutputStream>::get());
-            if ( m_xTruncate.is() )
-                tmp.push_back(cppu::UnoType<io::XTruncate>::get());
-            if ( m_xAsyncOutputMonitor.is() )
-                tmp.push_back(cppu::UnoType<io::XAsyncOutputMonitor>::get());
-
-            m_aTypes = comphelper::containerToSequence(tmp);
-        }
+            cppu::UnoType<lang::XTypeProvider>::get(),
+            cppu::UnoType<embed::XExtendedStorageStream>::get()
+        };
+
+        if ( m_xSeekable.is() )
+            tmp.push_back(cppu::UnoType<io::XSeekable>::get());
+        if ( m_xInputStream.is() )
+            tmp.push_back(cppu::UnoType<io::XInputStream>::get());
+        if ( m_xOutputStream.is() )
+            tmp.push_back(cppu::UnoType<io::XOutputStream>::get());
+        if ( m_xTruncate.is() )
+            tmp.push_back(cppu::UnoType<io::XTruncate>::get());
+        if ( m_xAsyncOutputMonitor.is() )
+            tmp.push_back(cppu::UnoType<io::XAsyncOutputMonitor>::get());
+
+        m_aTypes = comphelper::containerToSequence(tmp);
     }
     return m_aTypes;
 }

Reply via email to