diff options
Diffstat (limited to 'unotools/source/config/dynamicmenuoptions.cxx')
-rw-r--r-- | unotools/source/config/dynamicmenuoptions.cxx | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx index 76950ee441bc..ec80822b4d65 100644 --- a/unotools/source/config/dynamicmenuoptions.cxx +++ b/unotools/source/config/dynamicmenuoptions.cxx @@ -887,29 +887,17 @@ void SvtDynamicMenuOptions::AppendItem( EDynamicMenuType eMenu m_pDataContainer->AppendItem( eMenu, sURL, sTitle, sImageIdentifier, sTargetName ); } +namespace +{ + class theDynamicMenuOptionsMutex : public rtl::Static<osl::Mutex, theDynamicMenuOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtDynamicMenuOptions::GetOwnStaticMutex() { - // 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 fastr 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 theDynamicMenuOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |