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.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2024-10-03 16:10:32 +02:00 committed by Noel Grandin
parent 9c59f0bc66
commit 94c33fb4f2

View file

@ -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();