scripting/source/provider/MasterScriptProvider.cxx |   21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

New commits:
commit 94c33fb4f2141d9015db5ec4ea889e28ba27fa68
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Thu Oct 3 16:10:32 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Oct 3 18:44:28 2024 +0200

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

diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index b9e5426d5391..ccbe721350a5 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -334,21 +334,18 @@ MasterScriptProvider::getScript( const OUString& 
scriptURI )
 ProviderCache*
 MasterScriptProvider::providerCache()
 {
+    std::scoped_lock aGuard( m_mutex );
     if ( !m_pPCache )
     {
-        std::scoped_lock aGuard( m_mutex );
-        if ( !m_pPCache )
-        {
-            Sequence<OUString> denylist { 
u"com.sun.star.script.provider.ScriptProviderForBasic"_ustr };
+        Sequence<OUString> denylist { 
u"com.sun.star.script.provider.ScriptProviderForBasic"_ustr };
 
-            if ( !m_bIsPkgMSP )
-            {
-                m_pPCache.reset( new ProviderCache( m_xContext, m_sAargs ) );
-            }
-            else
-            {
-                m_pPCache.reset( new ProviderCache( m_xContext, m_sAargs, 
denylist ) );
-            }
+        if ( !m_bIsPkgMSP )
+        {
+            m_pPCache.reset( new ProviderCache( m_xContext, m_sAargs ) );
+        }
+        else
+        {
+            m_pPCache.reset( new ProviderCache( m_xContext, m_sAargs, denylist 
) );
         }
     }
     return m_pPCache.get();

Reply via email to