summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2018-07-29 18:22:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-29 23:06:39 +0200
commitc9697dc2abb2d23ffbb8253ce8b0ff0314d86984 (patch)
tree2e0eb42b0b8fe88697f34864dae8cbe6e0811e56 /cppuhelper
parent1eeb8d34760e63c0ab2b52a27f43141bcde84297 (diff)
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>
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/component.cxx22
1 files changed, 7 insertions, 15 deletions
diff --git a/cppuhelper/source/component.cxx b/cppuhelper/source/component.cxx
index 1c3585ee17d4..c9bd6a4a9b28 100644
--- a/cppuhelper/source/component.cxx
+++ b/cppuhelper/source/component.cxx
@@ -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