replace double checked locking patterns
with thread safe static initialization Change-Id: I4c751a47e3bdf52bbfb67d4f3aabd6f442e30118 Reviewed-on: https://gerrit.libreoffice.org/58287 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
1eeb8d3476
commit
c9697dc2ab
@@ -158,17 +158,10 @@ struct MappingsData
|
|||||||
|
|
||||||
static MappingsData & getMappingsData()
|
static MappingsData & getMappingsData()
|
||||||
{
|
{
|
||||||
static MappingsData * s_p = nullptr;
|
//TODO This memory is leaked; see #i63473# for when this should be
|
||||||
if (! s_p)
|
// changed again:
|
||||||
{
|
static MappingsData * s_p(new MappingsData);
|
||||||
MutexGuard aGuard( Mutex::getGlobalMutex() );
|
|
||||||
if (! s_p)
|
|
||||||
{
|
|
||||||
//TODO This memory is leaked; see #i63473# for when this should be
|
|
||||||
// changed again:
|
|
||||||
s_p = new MappingsData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return *s_p;
|
return *s_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -112,21 +112,13 @@ void OComponentHelper::release() throw()
|
|||||||
|
|
||||||
Sequence< Type > OComponentHelper::getTypes()
|
Sequence< Type > OComponentHelper::getTypes()
|
||||||
{
|
{
|
||||||
static OTypeCollection * s_pTypes = nullptr;
|
static OTypeCollection s_aTypes(
|
||||||
if (! s_pTypes)
|
cppu::UnoType<lang::XComponent>::get(),
|
||||||
{
|
cppu::UnoType<lang::XTypeProvider>::get(),
|
||||||
MutexGuard aGuard( Mutex::getGlobalMutex() );
|
cppu::UnoType<XAggregation>::get(),
|
||||||
if (! s_pTypes)
|
cppu::UnoType<XWeak>::get() );
|
||||||
{
|
|
||||||
static OTypeCollection s_aTypes(
|
return s_aTypes.getTypes();
|
||||||
cppu::UnoType<lang::XComponent>::get(),
|
|
||||||
cppu::UnoType<lang::XTypeProvider>::get(),
|
|
||||||
cppu::UnoType<XAggregation>::get(),
|
|
||||||
cppu::UnoType<XWeak>::get() );
|
|
||||||
s_pTypes = &s_aTypes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return s_pTypes->getTypes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// XComponent
|
// XComponent
|
||||||
|
Reference in New Issue
Block a user