summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/config/helpopt.cxx13
-rw-r--r--svtools/source/config/menuoptions.cxx21
-rw-r--r--svtools/source/config/printoptions.cxx21
3 files changed, 8 insertions, 47 deletions
diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx
index 381d67f7f0a4..bc1ac4d014c1 100644
--- a/svtools/source/config/helpopt.cxx
+++ b/svtools/source/config/helpopt.cxx
@@ -98,18 +98,9 @@ Sequence< OUString > const & SvtHelpOptions_Impl::GetPropertyNames()
::osl::Mutex & SvtHelpOptions_Impl::getInitMutex()
{
- static ::osl::Mutex *pMutex = nullptr;
+ static ::osl::Mutex ourMutex;
- if( ! pMutex )
- {
- ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
- if( ! pMutex )
- {
- static ::osl::Mutex mutex;
- pMutex = &mutex;
- }
- }
- return *pMutex;
+ return ourMutex;
}
SvtHelpOptions_Impl::SvtHelpOptions_Impl()
diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx
index cc8b64b760bc..8bec940d4000 100644
--- a/svtools/source/config/menuoptions.cxx
+++ b/svtools/source/config/menuoptions.cxx
@@ -410,24 +410,9 @@ void SvtMenuOptions::SetContextMenuShortcuts(TriState eState)
Mutex& SvtMenuOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = nullptr;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == nullptr )
- {
- // ... 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 our class will be faster than these!
- if( pMutex == nullptr )
- {
- // 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;
+ static Mutex ourMutex;
+
+ return ourMutex;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx
index be4a73644d4d..05ac6875d4a4 100644
--- a/svtools/source/config/printoptions.cxx
+++ b/svtools/source/config/printoptions.cxx
@@ -508,24 +508,9 @@ SvtBasePrintOptions::~SvtBasePrintOptions()
Mutex& SvtBasePrintOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = nullptr;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == nullptr )
- {
- // ... 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 our class will be faster than these!
- if( pMutex == nullptr )
- {
- // 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;
+ static Mutex ourMutex;
+
+ return ourMutex;
}
bool SvtBasePrintOptions::IsReduceTransparency() const