cid#1606918 Data race condition

and

cid#1606991 Data race condition
cid#1607010 Data race condition
cid#1607323 Data race condition
cid#1607335 Data race condition
cid#1607635 Data race condition
cid#1608162 Data race condition

Change-Id: I65edcf08f92fb564d56d0e8954212533c1cbec91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173895
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-09-24 21:18:20 +01:00
parent cd5dcc6e43
commit 695a46783e

View file

@ -685,8 +685,8 @@ class ImplIntrospectionAccess : public IntrospectionAccessHelper
Reference<XEnumerationAccess> getXEnumerationAccess();
Reference<XIdlArray> getXIdlArray();
void cacheXNameContainer();
void cacheXIndexContainer();
void cacheXNameContainer(const std::unique_lock<std::mutex>& rGuard);
void cacheXIndexContainer(const std::unique_lock<std::mutex>& rGuard);
public:
ImplIntrospectionAccess( Any obj, rtl::Reference< IntrospectionAccessStatic_Impl > pStaticImpl_ );
@ -797,7 +797,7 @@ Reference<XElementAccess> ImplIntrospectionAccess::getXElementAccess()
return mxObjElementAccess;
}
void ImplIntrospectionAccess::cacheXNameContainer()
void ImplIntrospectionAccess::cacheXNameContainer(const std::unique_lock<std::mutex>& /*rGuard*/)
{
Reference<XNameContainer> xNameContainer;
Reference<XNameReplace> xNameReplace;
@ -819,7 +819,6 @@ void ImplIntrospectionAccess::cacheXNameContainer()
}
{
std::unique_lock aGuard( m_aMutex );
if( !mxObjNameContainer.is() )
mxObjNameContainer = xNameContainer;
if( !mxObjNameReplace.is() )
@ -834,10 +833,8 @@ Reference<XNameContainer> ImplIntrospectionAccess::getXNameContainer()
std::unique_lock aGuard( m_aMutex );
if( !mxObjNameContainer.is() )
{
aGuard.unlock();
cacheXNameContainer();
}
cacheXNameContainer(aGuard);
return mxObjNameContainer;
}
@ -846,10 +843,8 @@ Reference<XNameReplace> ImplIntrospectionAccess::getXNameReplace()
std::unique_lock aGuard( m_aMutex );
if( !mxObjNameReplace.is() )
{
aGuard.unlock();
cacheXNameContainer();
}
cacheXNameContainer(aGuard);
return mxObjNameReplace;
}
@ -858,14 +853,12 @@ Reference<XNameAccess> ImplIntrospectionAccess::getXNameAccess()
std::unique_lock aGuard( m_aMutex );
if( !mxObjNameAccess.is() )
{
aGuard.unlock();
cacheXNameContainer();
}
cacheXNameContainer(aGuard);
return mxObjNameAccess;
}
void ImplIntrospectionAccess::cacheXIndexContainer()
void ImplIntrospectionAccess::cacheXIndexContainer(const std::unique_lock<std::mutex>& /*rGuard*/)
{
Reference<XIndexContainer> xIndexContainer;
Reference<XIndexReplace> xIndexReplace;
@ -887,7 +880,6 @@ void ImplIntrospectionAccess::cacheXIndexContainer()
}
{
std::unique_lock aGuard( m_aMutex );
if( !mxObjIndexContainer.is() )
mxObjIndexContainer = xIndexContainer;
if( !mxObjIndexReplace.is() )
@ -902,10 +894,8 @@ Reference<XIndexContainer> ImplIntrospectionAccess::getXIndexContainer()
std::unique_lock aGuard( m_aMutex );
if( !mxObjIndexContainer.is() )
{
aGuard.unlock();
cacheXIndexContainer();
}
cacheXIndexContainer(aGuard);
return mxObjIndexContainer;
}
@ -914,10 +904,8 @@ Reference<XIndexReplace> ImplIntrospectionAccess::getXIndexReplace()
std::unique_lock aGuard( m_aMutex );
if( !mxObjIndexReplace.is() )
{
aGuard.unlock();
cacheXIndexContainer();
}
cacheXIndexContainer(aGuard);
return mxObjIndexReplace;
}
@ -926,10 +914,8 @@ Reference<XIndexAccess> ImplIntrospectionAccess::getXIndexAccess()
std::unique_lock aGuard( m_aMutex );
if( !mxObjIndexAccess.is() )
{
aGuard.unlock();
cacheXIndexContainer();
}
cacheXIndexContainer(aGuard);
return mxObjIndexAccess;
}