Resolves: tdf#165295 partial cid#1555986 lock acquisition evasion revert
seeing as getTypeEntries can be reentrant Change-Id: Ice119e2a48d4912722a35843bd1c5078805249bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181799 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -97,6 +97,7 @@ static bool td_equals(typelib_TypeDescriptionReference const* pTDR1,
|
||||
static cppu::type_entry* getTypeEntries(cppu::class_data* cd)
|
||||
{
|
||||
cppu::type_entry* pEntries = cd->m_typeEntries;
|
||||
if (!cd->m_storedTypeRefs) // not inited?
|
||||
{
|
||||
static std::mutex aMutex;
|
||||
std::scoped_lock guard(aMutex);
|
||||
@@ -121,9 +122,14 @@ static cppu::type_entry* getTypeEntries(cppu::class_data* cd)
|
||||
// ref is statically held by getCppuType()
|
||||
pEntry->m_type.typeRef = rType.getTypeLibType();
|
||||
}
|
||||
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
|
||||
cd->m_storedTypeRefs = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
|
||||
}
|
||||
return pEntries;
|
||||
}
|
||||
|
||||
|
@@ -81,6 +81,7 @@ static bool td_equals(typelib_TypeDescriptionReference const* pTDR1,
|
||||
static cppu::type_entry* getTypeEntries(cppu::class_data* cd)
|
||||
{
|
||||
cppu::type_entry* pEntries = cd->m_typeEntries;
|
||||
if (!cd->m_storedTypeRefs) // not inited?
|
||||
{
|
||||
static std::mutex aMutex;
|
||||
std::scoped_lock guard(aMutex);
|
||||
@@ -105,9 +106,14 @@ static cppu::type_entry* getTypeEntries(cppu::class_data* cd)
|
||||
// ref is statically held by getCppuType()
|
||||
pEntry->m_type.typeRef = rType.getTypeLibType();
|
||||
}
|
||||
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
|
||||
cd->m_storedTypeRefs = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
|
||||
}
|
||||
return pEntries;
|
||||
}
|
||||
|
||||
|
@@ -64,6 +64,7 @@ static bool td_equals(
|
||||
static type_entry * getTypeEntries( class_data * cd )
|
||||
{
|
||||
type_entry * pEntries = cd->m_typeEntries;
|
||||
if (! cd->m_storedTypeRefs) // not inited?
|
||||
{
|
||||
static std::mutex aMutex;
|
||||
std::scoped_lock guard( aMutex );
|
||||
@@ -85,9 +86,14 @@ static type_entry * getTypeEntries( class_data * cd )
|
||||
// ref is statically held by getCppuType()
|
||||
pEntry->m_type.typeRef = rType.getTypeLibType();
|
||||
}
|
||||
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
|
||||
cd->m_storedTypeRefs = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
|
||||
}
|
||||
return pEntries;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user