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.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2024-10-03 19:08:14 +02:00 committed by Noel Grandin
parent 5195aadf1c
commit 46f5aa4f58

View file

@ -785,15 +785,8 @@ ImplIntrospectionAccess::ImplIntrospectionAccess
Reference<XElementAccess> ImplIntrospectionAccess::getXElementAccess() Reference<XElementAccess> ImplIntrospectionAccess::getXElementAccess()
{ {
std::unique_lock aGuard( m_aMutex ); std::unique_lock aGuard( m_aMutex );
if( !mxObjElementAccess.is() ) if( !mxObjElementAccess.is() )
{ mxObjElementAccess.set( mxIface, UNO_QUERY );
aGuard.unlock();
Reference<XElementAccess> xElementAccess( mxIface, UNO_QUERY );
aGuard.lock();
if( !mxObjElementAccess.is() )
mxObjElementAccess = std::move(xElementAccess);
}
return mxObjElementAccess; return mxObjElementAccess;
} }
@ -922,30 +915,16 @@ Reference<XIndexAccess> ImplIntrospectionAccess::getXIndexAccess()
Reference<XEnumerationAccess> ImplIntrospectionAccess::getXEnumerationAccess() Reference<XEnumerationAccess> ImplIntrospectionAccess::getXEnumerationAccess()
{ {
std::unique_lock aGuard( m_aMutex ); std::unique_lock aGuard( m_aMutex );
if( !mxObjEnumerationAccess.is() ) if( !mxObjEnumerationAccess.is() )
{ mxObjEnumerationAccess.set( mxIface, UNO_QUERY );
aGuard.unlock();
Reference<XEnumerationAccess> xEnumerationAccess( mxIface, UNO_QUERY );
aGuard.lock();
if( !mxObjEnumerationAccess.is() )
mxObjEnumerationAccess = std::move(xEnumerationAccess);
}
return mxObjEnumerationAccess; return mxObjEnumerationAccess;
} }
Reference<XIdlArray> ImplIntrospectionAccess::getXIdlArray() Reference<XIdlArray> ImplIntrospectionAccess::getXIdlArray()
{ {
std::unique_lock aGuard( m_aMutex ); std::unique_lock aGuard( m_aMutex );
if( !mxObjIdlArray.is() ) if( !mxObjIdlArray.is() )
{ mxObjIdlArray.set( mxIface, UNO_QUERY );
aGuard.unlock();
Reference<XIdlArray> xIdlArray( mxIface, UNO_QUERY );
aGuard.lock();
if( !mxObjIdlArray.is() )
mxObjIdlArray = std::move(xIdlArray);
}
return mxObjIdlArray; return mxObjIdlArray;
} }