Kaydet (Commit) c9697dc2 authored tarafından Jochen Nitschke's avatar Jochen Nitschke Kaydeden (comit) Noel Grandin

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: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 1eeb8d34
......@@ -158,17 +158,10 @@ struct MappingsData
static MappingsData & getMappingsData()
{
static MappingsData * s_p = nullptr;
if (! s_p)
{
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;
}
}
//TODO This memory is leaked; see #i63473# for when this should be
// changed again:
static MappingsData * s_p(new MappingsData);
return *s_p;
}
......
......@@ -112,21 +112,13 @@ void OComponentHelper::release() throw()
Sequence< Type > OComponentHelper::getTypes()
{
static OTypeCollection * s_pTypes = nullptr;
if (! s_pTypes)
{
MutexGuard aGuard( Mutex::getGlobalMutex() );
if (! s_pTypes)
{
static OTypeCollection s_aTypes(
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();
static OTypeCollection s_aTypes(
cppu::UnoType<lang::XComponent>::get(),
cppu::UnoType<lang::XTypeProvider>::get(),
cppu::UnoType<XAggregation>::get(),
cppu::UnoType<XWeak>::get() );
return s_aTypes.getTypes();
}
// XComponent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment