diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2018-07-29 18:22:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-29 23:06:39 +0200 |
commit | c9697dc2abb2d23ffbb8253ce8b0ff0314d86984 (patch) | |
tree | 2e0eb42b0b8fe88697f34864dae8cbe6e0811e56 /cppu | |
parent | 1eeb8d34760e63c0ab2b52a27f43141bcde84297 (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 'cppu')
-rw-r--r-- | cppu/source/uno/lbmap.cxx | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx index e1c606bf5c67..c5ce6709991f 100644 --- a/cppu/source/uno/lbmap.cxx +++ b/cppu/source/uno/lbmap.cxx @@ -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; } |