From 29489b33b435683021b72cb2bce27aba8cb7a430 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 21 Oct 2021 12:31:03 +0200 Subject: loplugin:flatten Change-Id: I3b4226a9d089ec9aedab95d96e50a068f57a76c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123991 Tested-by: Jenkins Reviewed-by: Noel Grandin --- unotools/source/config/moduleoptions.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'unotools/source/config/moduleoptions.cxx') diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index 35018b8b88c7..e73165ff4b18 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -780,19 +780,19 @@ osl::Mutex& impl_GetOwnStaticMutex() SvtModuleOptions::SvtModuleOptions() { // no need to take the mutex yet, shared_ptr/weak_ptr are thread-safe + m_pImpl = g_pModuleOptions.lock(); + if( m_pImpl ) + return; + + // take the mutex, so we don't accidentally create more than one + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + m_pImpl = g_pModuleOptions.lock(); if( !m_pImpl ) { - // take the mutex, so we don't accidentally create more than one - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - - m_pImpl = g_pModuleOptions.lock(); - if( !m_pImpl ) - { - m_pImpl = std::make_shared(); - g_pModuleOptions = m_pImpl; - ItemHolder1::holdConfigItem(EItem::ModuleOptions); - } + m_pImpl = std::make_shared(); + g_pModuleOptions = m_pImpl; + ItemHolder1::holdConfigItem(EItem::ModuleOptions); } } -- cgit