diff options
Diffstat (limited to 'unotools/source/config/securityoptions.cxx')
-rw-r--r-- | unotools/source/config/securityoptions.cxx | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx index fb0ea146b71c..21914d1a402f 100644 --- a/unotools/source/config/securityoptions.cxx +++ b/unotools/source/config/securityoptions.cxx @@ -1166,26 +1166,14 @@ bool SvtSecurityOptions::IsOptionEnabled( EOption eOption ) const return m_pDataContainer->IsOptionEnabled( eOption ); } +namespace +{ + class theSecurityOptionsMutex : public rtl::Static<osl::Mutex, theSecurityOptionsMutex>{}; +} + Mutex& SvtSecurityOptions::GetInitMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be faster then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theSecurityOptionsMutex::get(); } |