sfx2/source/control/thumbnailviewacc.hxx |    6 +++++-
 stoc/source/inspect/introspection.cxx    |   27 +++------------------------
 2 files changed, 8 insertions(+), 25 deletions(-)

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

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

diff --git a/stoc/source/inspect/introspection.cxx 
b/stoc/source/inspect/introspection.cxx
index 716e35c95df1..114983d08a7f 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -785,15 +785,8 @@ ImplIntrospectionAccess::ImplIntrospectionAccess
 Reference<XElementAccess> ImplIntrospectionAccess::getXElementAccess()
 {
     std::unique_lock aGuard( m_aMutex );
-
     if( !mxObjElementAccess.is() )
-    {
-        aGuard.unlock();
-        Reference<XElementAccess> xElementAccess( mxIface, UNO_QUERY );
-        aGuard.lock();
-        if( !mxObjElementAccess.is() )
-            mxObjElementAccess = std::move(xElementAccess);
-    }
+        mxObjElementAccess.set( mxIface, UNO_QUERY );
     return mxObjElementAccess;
 }
 
@@ -922,30 +915,16 @@ Reference<XIndexAccess> 
ImplIntrospectionAccess::getXIndexAccess()
 Reference<XEnumerationAccess> ImplIntrospectionAccess::getXEnumerationAccess()
 {
     std::unique_lock aGuard( m_aMutex );
-
     if( !mxObjEnumerationAccess.is() )
-    {
-        aGuard.unlock();
-        Reference<XEnumerationAccess> xEnumerationAccess( mxIface, UNO_QUERY );
-        aGuard.lock();
-        if( !mxObjEnumerationAccess.is() )
-            mxObjEnumerationAccess = std::move(xEnumerationAccess);
-    }
+        mxObjEnumerationAccess.set( mxIface, UNO_QUERY );
     return mxObjEnumerationAccess;
 }
 
 Reference<XIdlArray> ImplIntrospectionAccess::getXIdlArray()
 {
     std::unique_lock aGuard( m_aMutex );
-
     if( !mxObjIdlArray.is() )
-    {
-        aGuard.unlock();
-        Reference<XIdlArray> xIdlArray( mxIface, UNO_QUERY );
-        aGuard.lock();
-        if( !mxObjIdlArray.is() )
-            mxObjIdlArray = std::move(xIdlArray);
-    }
+        mxObjIdlArray.set( mxIface, UNO_QUERY );
     return mxObjIdlArray;
 }
 
commit 5195aadf1cfcf53316ff4d5b36635548e95120cb
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Thu Oct 3 18:57:07 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Oct 5 08:57:25 2024 +0200

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

diff --git a/sfx2/source/control/thumbnailviewacc.hxx 
b/sfx2/source/control/thumbnailviewacc.hxx
index 63ea533009ad..e483e64a7afc 100644
--- a/sfx2/source/control/thumbnailviewacc.hxx
+++ b/sfx2/source/control/thumbnailviewacc.hxx
@@ -54,7 +54,11 @@ public:
                               const css::uno::Any& rOldValue,
                               const css::uno::Any& rNewValue );
 
-    bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 
); }
+    bool HasAccessibleListeners() const
+    {
+        std::unique_lock aGuard (m_aMutex);
+        return( mxEventListeners.size() > 0 );
+    }
 
 public:
     /** Called by the corresponding ValueSet when it gets the focus.

Reply via email to