[Libreoffice-commits] .: 7 commits - comphelper/inc comphelper/source svtools/source toolkit/source unotools/source
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Apr 4 03:01:51 PDT 2011
comphelper/inc/comphelper/accimplaccess.hxx | 2 -
comphelper/inc/comphelper/componentmodule.hxx | 17 ++++-----
comphelper/inc/comphelper/servicehelper.hxx | 32 +++++++++++-------
comphelper/inc/comphelper/uno3.hxx | 17 +++------
comphelper/source/misc/accimplaccess.cxx | 18 ++--------
comphelper/source/misc/comphelper_services.cxx | 20 ++++++++---
comphelper/source/misc/uieventslogger.cxx | 36 ++++++---------------
comphelper/source/property/propstate.cxx | 16 ++-------
svtools/source/config/optionsdrawinglayer.cxx | 25 ++++----------
toolkit/source/controls/geometrycontrolmodel.cxx | 18 ++++------
unotools/source/config/cacheoptions.cxx | 25 ++++----------
unotools/source/config/cmdoptions.cxx | 25 ++++----------
unotools/source/config/compatibility.cxx | 24 +++-----------
unotools/source/config/dynamicmenuoptions.cxx | 24 +++-----------
unotools/source/config/eventcfg.cxx | 26 +++------------
unotools/source/config/extendedsecurityoptions.cxx | 24 +++-----------
unotools/source/config/fontoptions.cxx | 25 ++++----------
unotools/source/config/historyoptions.cxx | 24 +++-----------
unotools/source/config/internaloptions.cxx | 24 +++-----------
unotools/source/config/localisationoptions.cxx | 24 +++-----------
unotools/source/config/moduleoptions.cxx | 24 +++-----------
unotools/source/config/optionsdlg.cxx | 18 +++-------
unotools/source/config/printwarningoptions.cxx | 24 +++-----------
unotools/source/config/regoptions.cxx | 18 ++++------
unotools/source/config/securityoptions.cxx | 24 +++-----------
unotools/source/config/startoptions.cxx | 24 +++-----------
unotools/source/config/useroptions.cxx | 25 +++-----------
unotools/source/config/viewoptions.cxx | 24 +++-----------
unotools/source/config/workingsetoptions.cxx | 24 +++-----------
29 files changed, 202 insertions(+), 449 deletions(-)
New commits:
commit e21be91fd10bc3fbf720a100ce65700a2a0e1026
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Apr 4 10:33:31 2011 +0100
add missing header
diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index 8937b8b..388535b 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
+#include <rtl/instance.hxx>
//_________________________________________________________________________________________________________________
// namespaces
commit 3a031af8fc9721901f19909bf80e5c0f244001f9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Apr 4 09:45:04 2011 +0100
fix typo
diff --git a/comphelper/inc/comphelper/servicehelper.hxx b/comphelper/inc/comphelper/servicehelper.hxx
index 598be76..81b0050 100644
--- a/comphelper/inc/comphelper/servicehelper.hxx
+++ b/comphelper/inc/comphelper/servicehelper.hxx
@@ -70,7 +70,7 @@ namespace \
} \
const ::com::sun::star::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \
{ \
- return the##classname##UnoTunnelId::get()::getSeq(); \
+ return the##classname##UnoTunnelId::get().getSeq(); \
} \
\
classname* classname::getImplementation( const uno::Reference< uno::XInterface >& xInt ) \
commit a731cf242bf3bc77e852c6974251380f52a0e8c2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Apr 3 21:38:23 2011 +0100
use rtl::Static where double-locked pattern used
diff --git a/toolkit/source/controls/geometrycontrolmodel.cxx b/toolkit/source/controls/geometrycontrolmodel.cxx
index 4fe7753..41c65ed 100644
--- a/toolkit/source/controls/geometrycontrolmodel.cxx
+++ b/toolkit/source/controls/geometrycontrolmodel.cxx
@@ -593,20 +593,16 @@
return new OCommonGeometryControlModel( _rxAggregateInstance, m_sServiceSpecifier );
}
+ namespace
+ {
+ class theOCommonGeometryControlModelImplementationId :
+ public rtl::Static< ::cppu::OImplementationId, theOCommonGeometryControlModelImplementationId > {};
+ }
+
//--------------------------------------------------------------------
Sequence< sal_Int8 > SAL_CALL OCommonGeometryControlModel::getImplementationId( ) throw (RuntimeException)
{
- static ::cppu::OImplementationId * pId = NULL;
- if ( !pId )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !pId )
- {
- static ::cppu::OImplementationId s_aId;
- pId = &s_aId;
- }
- }
- return pId->getImplementationId();
+ return theOCommonGeometryControlModelImplementationId::get().getImplementationId();
}
//--------------------------------------------------------------------
commit 69d824f089e5ed919f3302b727ac78f1f8e245c1
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Apr 3 21:34:16 2011 +0100
use rtl::Static where double-locked pattern used
diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index 60df691..8937b8b 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -1685,29 +1685,17 @@ void SvtOptionsDrawinglayer::SetSelectionMaximumLuminancePercent( sal_uInt16 nPe
m_pDataContainer->SetSelectionMaximumLuminancePercent( nPercent );
}
+namespace
+{
+ class theOptionsDrawinglayerMutex : public rtl::Static<osl::Mutex, theOptionsDrawinglayerMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtOptionsDrawinglayer::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 theOptionsDrawinglayerMutex::get();
}
// eof
diff --git a/unotools/source/config/cacheoptions.cxx b/unotools/source/config/cacheoptions.cxx
index b87c344..3525777 100644
--- a/unotools/source/config/cacheoptions.cxx
+++ b/unotools/source/config/cacheoptions.cxx
@@ -32,6 +32,7 @@
#include <unotools/cacheoptions.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/configitem.hxx>
+#include <rtl/instance.hxx>
#include <tools/debug.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -481,29 +482,17 @@ void SvtCacheOptions::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgrObjec
m_pDataContainer->SetGraphicManagerObjectReleaseTime( nGrfMgrObjectReleaseTime );
}
+namespace
+{
+ class theCacheOptionsMutex : public rtl::Static<osl::Mutex, theCacheOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtCacheOptions::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 theCacheOptionsMutex::get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx
index 17c986a..fbcbc04 100644
--- a/unotools/source/config/cmdoptions.cxx
+++ b/unotools/source/config/cmdoptions.cxx
@@ -42,6 +42,7 @@
#include <cppuhelper/weakref.hxx>
#include <tools/urlobj.hxx>
#include <rtl/ustrbuf.hxx>
+#include <rtl/instance.hxx>
#include <itemholder1.hxx>
@@ -593,29 +594,17 @@ void SvtCommandOptions::EstablisFrameCallback(const ::com::sun::star::uno::Refer
m_pDataContainer->EstablisFrameCallback(xFrame);
}
+namespace
+{
+ class theCommandOptionsMutex : public rtl::Static<osl::Mutex, theCommandOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtCommandOptions::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 theCommandOptionsMutex::get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx
index 17cf8f1..7771e29 100644
--- a/unotools/source/config/compatibility.cxx
+++ b/unotools/source/config/compatibility.cxx
@@ -817,29 +817,17 @@ Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions::GetList() const
return m_pDataContainer->GetList();
}
+namespace
+{
+ class theCompatibilityOptionsMutex : public rtl::Static<osl::Mutex, theCompatibilityOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtCompatibilityOptions::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 theCompatibilityOptionsMutex::get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx
index 80dc97a..93e68ea 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: */
diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx
index 83dc8b5..9c9173b 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -423,28 +423,14 @@ sal_Bool SAL_CALL GlobalEventConfig::hasElements( ) throw (RuntimeException)
return m_pImpl->hasElements( );
}
+namespace
+{
+ class theGlobalEventConfigMutex : public rtl::Static<osl::Mutex, theGlobalEventConfigMutex>{};
+}
+
Mutex& GlobalEventConfig::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 following 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 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 theGlobalEventConfigMutex::get();
}
::rtl::OUString GlobalEventConfig::GetEventName( sal_Int32 nIndex )
diff --git a/unotools/source/config/extendedsecurityoptions.cxx b/unotools/source/config/extendedsecurityoptions.cxx
index f20ceaf..926f32d 100644
--- a/unotools/source/config/extendedsecurityoptions.cxx
+++ b/unotools/source/config/extendedsecurityoptions.cxx
@@ -509,29 +509,17 @@ void SvtExtendedSecurityOptions::SetOpenHyperlinkMode( SvtExtendedSecurityOption
m_pDataContainer->SetOpenHyperlinkMode( eMode );
}
+namespace
+{
+ class theExtendedSecurityOptionsMutex : public rtl::Static<osl::Mutex, theExtendedSecurityOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtExtendedSecurityOptions::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 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 theExtendedSecurityOptionsMutex::get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/fontoptions.cxx b/unotools/source/config/fontoptions.cxx
index 253e1c8..514927a 100644
--- a/unotools/source/config/fontoptions.cxx
+++ b/unotools/source/config/fontoptions.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
#include "itemholder1.hxx"
//_________________________________________________________________________________________________________________
@@ -480,29 +481,17 @@ void SvtFontOptions::EnableFontWYSIWYG( sal_Bool bState )
m_pDataContainer->EnableFontWYSIWYG( bState );
}
+namespace
+{
+ class theFontOptionsMutex : public rtl::Static<osl::Mutex, theFontOptionsMutex> {};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtFontOptions::impl_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 theFontOptionsMutex::get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx
index 485d0d1..f0ebe9a 100644
--- a/unotools/source/config/historyoptions.cxx
+++ b/unotools/source/config/historyoptions.cxx
@@ -699,29 +699,17 @@ void SvtHistoryOptions::AppendItem( EHistoryType eHistory ,
m_pDataContainer->AppendItem( eHistory, sURL, sFilter, sTitle, sPassword );
}
+namespace
+{
+ class theHistoryOptionsMutex : public rtl::Static<osl::Mutex, theHistoryOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtHistoryOptions::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 theHistoryOptionsMutex::get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/internaloptions.cxx b/unotools/source/config/internaloptions.cxx
index 8ff1f4e..86d6ea3 100644
--- a/unotools/source/config/internaloptions.cxx
+++ b/unotools/source/config/internaloptions.cxx
@@ -560,29 +560,17 @@ void SvtInternalOptions::SetCurrentTempURL( const OUString& aNewCurrentTempURL )
m_pDataContainer->SetCurrentTempURL( aNewCurrentTempURL );
}
+namespace
+{
+ class theInternalOptionsMutex : public rtl::Static<osl::Mutex, theInternalOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtInternalOptions::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 theInternalOptionsMutex::get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/localisationoptions.cxx b/unotools/source/config/localisationoptions.cxx
index a150e0f..8c1be26 100644
--- a/unotools/source/config/localisationoptions.cxx
+++ b/unotools/source/config/localisationoptions.cxx
@@ -427,29 +427,17 @@ void SvtLocalisationOptions::SetDialogScale( sal_Int32 nScale )
m_pDataContainer->SetDialogScale( nScale );
}
+namespace
+{
+ class theLocalisationOptionsMutex : public rtl::Static<osl::Mutex, theLocalisationOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtLocalisationOptions::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 theLocalisationOptionsMutex::get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx
index 8806957..d8032bc 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -38,6 +38,7 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -1278,6 +1279,10 @@ sal_uInt32 SvtModuleOptions::GetFeatures() const
return nFeature;
}
+namespace
+{
+ class theModuleOptionsMutex : public rtl::Static<osl::Mutex, theModuleOptionsMutex> {};
+}
/*-****************************************************************************************************//**
@short return a reference to a static mutex
@descr These class is threadsafe.
@@ -1294,24 +1299,7 @@ sal_uInt32 SvtModuleOptions::GetFeatures() const
*//*-*****************************************************************************************************/
::osl::Mutex& SvtModuleOptions::impl_GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static ::osl::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!
- ::osl::MutexGuard aGuard( ::osl::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 ::osl::Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theModuleOptionsMutex::get();
}
::rtl::OUString SvtModuleOptions::GetModuleName( EModule eModule ) const
diff --git a/unotools/source/config/optionsdlg.cxx b/unotools/source/config/optionsdlg.cxx
index 8e35666..b3f9297 100644
--- a/unotools/source/config/optionsdlg.cxx
+++ b/unotools/source/config/optionsdlg.cxx
@@ -92,20 +92,14 @@ public:
const OUString& _rGroup ) const;
};
-::osl::Mutex & SvtOptionsDlgOptions_Impl::getInitMutex()
+namespace
{
- static ::osl::Mutex *pMutex = 0;
+ class theOptionsDlgOptions_ImplMutex : public rtl::Static<osl::Mutex, theOptionsDlgOptions_ImplMutex>{};
+}
- if( ! pMutex )
- {
- ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
- if( ! pMutex )
- {
- static ::osl::Mutex mutex;
- pMutex = &mutex;
- }
- }
- return *pMutex;
+::osl::Mutex & SvtOptionsDlgOptions_Impl::getInitMutex()
+{
+ return theOptionsDlgOptions_ImplMutex::get();
}
// -----------------------------------------------------------------------
diff --git a/unotools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx
index a7247c6..abc55f5 100644
--- a/unotools/source/config/printwarningoptions.cxx
+++ b/unotools/source/config/printwarningoptions.cxx
@@ -390,29 +390,17 @@ void SvtPrintWarningOptions::SetModifyDocumentOnPrintingAllowed( sal_Bool bState
m_pDataContainer->SetModifyDocumentOnPrintingAllowed( bState ) ;
}
+namespace
+{
+ class thePrintWarningOptionsMutex : public rtl::Static<osl::Mutex, thePrintWarningOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtPrintWarningOptions::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 thePrintWarningOptionsMutex::get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/regoptions.cxx b/unotools/source/config/regoptions.cxx
index 8d2d35e..7d89c71 100644
--- a/unotools/source/config/regoptions.cxx
+++ b/unotools/source/config/regoptions.cxx
@@ -35,6 +35,7 @@
#include <osl/mutex.hxx>
#include <unotools/bootstrap.hxx>
#include <rtl/ustring.hxx>
+#include <rtl/instance.hxx>
//........................................................................
namespace utl
@@ -196,20 +197,15 @@ namespace utl
sal_Bool RegOptionsImpl::s_bThisSessionDone = sal_False;
sal_Int32 RegOptionsImpl::s_nInstanceCount = 0;
+ namespace
+ {
+ class theRegOptionsImplMutex : public rtl::Static<osl::Mutex, theRegOptionsImplMutex>{};
+ }
+
//--------------------------------------------------------------------
::osl::Mutex& RegOptionsImpl::getStaticMutex()
{
- static ::osl::Mutex* s_pStaticMutex = NULL;
- if ( !s_pStaticMutex )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !s_pStaticMutex )
- {
- static ::osl::Mutex s_aStaticMutex;
- s_pStaticMutex = &s_aStaticMutex;
- }
- }
- return *s_pStaticMutex;
+ return theRegOptionsImplMutex::get();
}
//--------------------------------------------------------------------
diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx
index 216e563..8d2fe8a 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();
}
diff --git a/unotools/source/config/startoptions.cxx b/unotools/source/config/startoptions.cxx
index de80733..44b6959 100644
--- a/unotools/source/config/startoptions.cxx
+++ b/unotools/source/config/startoptions.cxx
@@ -427,29 +427,17 @@ void SvtStartOptions::SetConnectionURL( const OUString& sURL )
m_pDataContainer->SetConnectionURL( sURL );
}
+namespace
+{
+ class theStartOptionsMutex : public rtl::Static<osl::Mutex, theStartOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtStartOptions::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 theStartOptionsMutex::get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx
index b34a5c6..5ba1596 100644
--- a/unotools/source/config/useroptions.cxx
+++ b/unotools/source/config/useroptions.cxx
@@ -985,27 +985,14 @@ SvtUserOptions::~SvtUserOptions()
// -----------------------------------------------------------------------
+namespace
+{
+ class theUserOptionsMutex : public rtl::Static<osl::Mutex, theUserOptionsMutex>{};
+}
+
::osl::Mutex& SvtUserOptions::GetInitMutex()
{
- // Initialize static mutex only for one time!
- static ::osl::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!
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- // We must check our pointer again -
- // because another instance of our class will be faster then this instance!
- if ( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static ::osl::Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theUserOptionsMutex::get();
}
// -----------------------------------------------------------------------
diff --git a/unotools/source/config/viewoptions.cxx b/unotools/source/config/viewoptions.cxx
index 2d47e22..f404e66 100644
--- a/unotools/source/config/viewoptions.cxx
+++ b/unotools/source/config/viewoptions.cxx
@@ -1225,29 +1225,17 @@ void SvtViewOptions::SetUserItem( const ::rtl::OUString& sName ,
}
}
+namespace
+{
+ class theViewOptionsMutex : public rtl::Static<osl::Mutex, theViewOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
::osl::Mutex& SvtViewOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static ::osl::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!
- ::osl::MutexGuard aGuard( ::osl::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 ::osl::Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theViewOptionsMutex::get();
}
void SvtViewOptions::AcquireOptions()
diff --git a/unotools/source/config/workingsetoptions.cxx b/unotools/source/config/workingsetoptions.cxx
index 40940b0..8e5e421 100644
--- a/unotools/source/config/workingsetoptions.cxx
+++ b/unotools/source/config/workingsetoptions.cxx
@@ -362,29 +362,17 @@ void SvtWorkingSetOptions::SetWindowList( const Sequence< OUString >& seqWindowL
m_pDataContainer->SetWindowList( seqWindowList );
}
+namespace
+{
+ class theWorkingSetOptionsMutex : public rtl::Static<osl::Mutex, theWorkingSetOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtWorkingSetOptions::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 theWorkingSetOptionsMutex::get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1bf0433e7783a9f416b8520986c3cc40130a2aee
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Apr 3 20:42:00 2011 +0100
use rtl::Static where double-locked pattern used
diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx
index 84a5b4d..29fad18 100644
--- a/comphelper/inc/comphelper/componentmodule.hxx
+++ b/comphelper/inc/comphelper/componentmodule.hxx
@@ -305,7 +305,7 @@ namespace comphelper
/* -------------------------------------------------------------------- */ \
class ModuleClass : public ::comphelper::OModule \
{ \
- friend struct CreateModuleClass; \
+ friend struct ModuleClass##Creator; \
typedef ::comphelper::OModule BaseClass; \
\
public: \
@@ -368,14 +368,14 @@ namespace comphelper
//= implementing a OModule for a component library
#define IMPLEMENT_COMPONENT_MODULE( ModuleClass ) \
- struct CreateModuleClass \
+ struct ModuleClass##Creator \
{ \
- ModuleClass* operator()() \
- { \
- static ModuleClass* pModule = new ModuleClass; \
- return pModule; \
- } \
+ ModuleClass m_aModuleClass; \
}; \
+ namespace \
+ { \
+ class the##ModuleClass##Instance : public rtl::Static<ModuleClass##Creator, the##ModuleClass##Instance> {}; \
+ } \
\
ModuleClass::ModuleClass() \
:BaseClass() \
@@ -384,8 +384,7 @@ namespace comphelper
\
ModuleClass& ModuleClass::getInstance() \
{ \
- return *rtl_Instance< ModuleClass, CreateModuleClass, ::osl::MutexGuard, ::osl::GetGlobalMutex >:: \
- create( CreateModuleClass(), ::osl::GetGlobalMutex() ); \
+ return the##ModuleClass##Instance::get().m_aModuleClass; \
} \
//==========================================================================
diff --git a/comphelper/inc/comphelper/servicehelper.hxx b/comphelper/inc/comphelper/servicehelper.hxx
index f5784b6..598be76 100644
--- a/comphelper/inc/comphelper/servicehelper.hxx
+++ b/comphelper/inc/comphelper/servicehelper.hxx
@@ -29,6 +29,21 @@
#ifndef _COMPHELPER_SERVICEHELPER_HXX_
#define _COMPHELPER_SERVICEHELPER_HXX_
+#include <rtl/uuid.h>
+#include <rtl/instance.hxx>
+
+class UnoTunnelIdInit
+{
+private:
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aSeq;
+public:
+ UnoTunnelIdInit() : m_aSeq(16)
+ {
+ rtl_createUuid( (sal_uInt8*)m_aSeq.getArray(), 0, sal_True );
+ }
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& getSeq() const { return m_aSeq; }
+};
+
/** the UNO3_GETIMPLEMENTATION_* macros implement a static helper function
that gives access to your implementation for a given interface reference,
if possible.
@@ -49,20 +64,13 @@
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
#define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
+namespace \
+{ \
+ class the##classname##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##classname##UnoTunnelId> {}; \
+} \
const ::com::sun::star::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \
{ \
- static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; \
- if( !pSeq ) \
- { \
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \
- if( !pSeq ) \
- { \
- static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); \
- rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); \
- pSeq = &aSeq; \
- } \
- } \
- return *pSeq; \
+ return the##classname##UnoTunnelId::get()::getSeq(); \
} \
\
classname* classname::getImplementation( const uno::Reference< uno::XInterface >& xInt ) \
diff --git a/comphelper/inc/comphelper/uno3.hxx b/comphelper/inc/comphelper/uno3.hxx
index 8cd7e90..0971858 100644
--- a/comphelper/inc/comphelper/uno3.hxx
+++ b/comphelper/inc/comphelper/uno3.hxx
@@ -30,6 +30,7 @@
#define _COMPHELPER_UNO3_HXX_
#include <osl/interlck.h>
+#include <rtl/instance.hxx>
#include <comphelper/types.hxx>
#include <com/sun/star/uno/XAggregation.hpp>
#include <comphelper/sequence.hxx>
@@ -197,19 +198,13 @@ namespace comphelper
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
#define IMPLEMENT_GET_IMPLEMENTATION_ID( classname ) \
+ namespace \
+ { \
+ class the##classname##ImplementationId : public rtl::Static< ::cppu::OImplementationId, the##classname##ImplementationId> {}; \
+ } \
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL classname::getImplementationId( ) throw (::com::sun::star::uno::RuntimeException) \
{ \
- static ::cppu::OImplementationId* pId = NULL; \
- if (!pId) \
- { \
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \
- if (!pId) \
- { \
- static ::cppu::OImplementationId aId; \
- pId = &aId; \
- } \
- } \
- return pId->getImplementationId(); \
+ return the##classname##ImplementationId::get().getImplementationId(); \
}
#define IMPLEMENT_FORWARD_XTYPEPROVIDER2( classname, baseclass1, baseclass2 ) \
commit 71532d0565d692139806295982d96b11975eb9d0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Apr 2 16:47:11 2011 +0100
use rtl::Static where double-locked pattern used
diff --git a/comphelper/inc/comphelper/accimplaccess.hxx b/comphelper/inc/comphelper/accimplaccess.hxx
index e2ed500..4fd1f34 100644
--- a/comphelper/inc/comphelper/accimplaccess.hxx
+++ b/comphelper/inc/comphelper/accimplaccess.hxx
@@ -154,7 +154,7 @@ namespace comphelper
private:
- COMPHELPER_DLLPRIVATE static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelImplementationId();
+ COMPHELPER_DLLPRIVATE static const ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
};
//.........................................................................
diff --git a/comphelper/source/misc/accimplaccess.cxx b/comphelper/source/misc/accimplaccess.cxx
index 499d1b5..d2f9478 100644
--- a/comphelper/source/misc/accimplaccess.cxx
+++ b/comphelper/source/misc/accimplaccess.cxx
@@ -121,21 +121,13 @@ namespace comphelper
return ( NULL != pImplementation );
}
+ namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
+
//---------------------------------------------------------------------
- const Sequence< sal_Int8 >& OAccessibleImplementationAccess::getUnoTunnelImplementationId()
+ const Sequence< sal_Int8 > OAccessibleImplementationAccess::getUnoTunnelImplementationId()
{
- static Sequence< sal_Int8 > aId;
- if ( !aId.getLength() )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !aId.getLength() )
- {
- static ::cppu::OImplementationId aImplId;
- // unfortunately, the OImplementationId::getImplementationId returns a copy, not a static reference ...
- aId = aImplId.getImplementationId();
- }
- }
- return aId;
+ ::cppu::OImplementationId &rID = lcl_ImplId::get();
+ return rID.getImplementationId();
}
//---------------------------------------------------------------------
diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx
index 74c29f7..28d8778 100644
--- a/comphelper/source/misc/comphelper_services.cxx
+++ b/comphelper/source/misc/comphelper_services.cxx
@@ -30,6 +30,8 @@
#include "comphelper_module.hxx"
+#include <rtl/instance.hxx>
+
//--------------------------------------------------------------------
extern void createRegistryInfo_OPropertyBag();
extern void createRegistryInfo_SequenceOutputStream();
@@ -49,13 +51,12 @@ namespace comphelper { namespace module
{
//........................................................................
- static void initializeModule()
+ namespace
{
- static bool bInitialized( false );
- if ( !bInitialized )
+ class doInitialize
{
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !bInitialized )
+ public:
+ doInitialize()
{
createRegistryInfo_OPropertyBag();
createRegistryInfo_SequenceOutputStream();
@@ -70,7 +71,14 @@ namespace comphelper { namespace module
createRegistryInfo_OSimpleLogRing();
createRegistryInfo_OOfficeRestartManager();
}
- }
+ };
+
+ struct theInitializer : public rtl::Static< doInitialize, theInitializer > {};
+ }
+
+ static void initializeModule()
+ {
+ theInitializer::get();
}
//........................................................................
diff --git a/comphelper/source/property/propstate.cxx b/comphelper/source/property/propstate.cxx
index 313c881..bb04dd3 100644
--- a/comphelper/source/property/propstate.cxx
+++ b/comphelper/source/property/propstate.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/uno/genfunc.h>
#include <cppuhelper/queryinterface.hxx>
#include <comphelper/sequence.hxx>
+#include <rtl/instance.hxx>
//.........................................................................
namespace comphelper
@@ -217,20 +218,13 @@ namespace comphelper
);
}
+ namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
+
//---------------------------------------------------------------------
Sequence< sal_Int8 > SAL_CALL OStatefulPropertySet::getImplementationId() throw(RuntimeException)
{
- static ::cppu::OImplementationId * pId = NULL;
- if ( !pId )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !pId )
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
+ ::cppu::OImplementationId &rID = lcl_ImplId::get();
+ return rID.getImplementationId();
}
//---------------------------------------------------------------------
commit 4dc3de695e575eddd9505c78e28493d7c334ecaf
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Apr 2 16:27:05 2011 +0100
use rtl::Static pattern here
diff --git a/comphelper/source/misc/uieventslogger.cxx b/comphelper/source/misc/uieventslogger.cxx
index 497e6fa..17a9267 100644
--- a/comphelper/source/misc/uieventslogger.cxx
+++ b/comphelper/source/misc/uieventslogger.cxx
@@ -49,6 +49,7 @@
#include <osl/mutex.hxx>
#include <osl/time.h>
#include <rtl/ustrbuf.hxx>
+#include <rtl/instance.hxx>
using namespace com::sun::star::beans;
@@ -143,7 +144,6 @@ namespace comphelper
// static methods and data
static ptr getInstance();
- static void prepareMutex();
static bool shouldActivate();
static bool getEnabledFromCoreController();
static bool getEnabledFromCfg();
@@ -152,7 +152,6 @@ namespace comphelper
static sal_Int32 findIdx(const Sequence<PropertyValue>& args, const OUString& key);
static ptr instance;
- static Mutex * singleton_mutex;
static const sal_Int32 COLUMNS;
static const OUString CFG_ENABLED;
static const OUString CFG_IDLETIMEOUT;
@@ -214,6 +213,10 @@ namespace comphelper
const OUString UiEventsLogger_Impl::URL_SPECIAL(RTL_CONSTASCII_USTRINGPARAM(".special:"));
const OUString UiEventsLogger_Impl::URL_FILE(RTL_CONSTASCII_USTRINGPARAM("file:"));
+ namespace
+ {
+ struct theSingletonMutex : public rtl::Static< Mutex, theSingletonMutex > {};
+ }
// public UiEventsLogger interface
sal_Bool UiEventsLogger::isEnabled()
@@ -221,8 +224,7 @@ namespace comphelper
if ( UiEventsLogger_Impl::getEnabledFromCfg() )
{
try {
- UiEventsLogger_Impl::prepareMutex();
- Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
+ Guard<Mutex> singleton_guard(theSingletonMutex::get());
return UiEventsLogger_Impl::getInstance()->m_Active;
} catch(...) { return false; } // never throws
} // if ( )
@@ -232,8 +234,7 @@ namespace comphelper
sal_Int32 UiEventsLogger::getSessionLogEventCount()
{
try {
- UiEventsLogger_Impl::prepareMutex();
- Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
+ Guard<Mutex> singleton_guard(theSingletonMutex::get());
return UiEventsLogger_Impl::getInstance()->m_SessionLogEventCount;
} catch(...) { return 0; } // never throws
}
@@ -269,8 +270,7 @@ namespace comphelper
const Sequence<PropertyValue>& args)
{
try {
- UiEventsLogger_Impl::prepareMutex();
- Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
+ Guard<Mutex> singleton_guard(theSingletonMutex::get());
UiEventsLogger_Impl::getInstance()->logDispatch(url, args);
} catch(...) { } // never throws
}
@@ -283,8 +283,7 @@ namespace comphelper
const OUString& param)
{
try {
- UiEventsLogger_Impl::prepareMutex();
- Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
+ Guard<Mutex> singleton_guard(theSingletonMutex::get());
UiEventsLogger_Impl::getInstance()->logVcl(parent_id, window_type, id, method, param);
} catch(...) { } // never throws
}
@@ -313,16 +312,14 @@ namespace comphelper
void UiEventsLogger::disposing()
{
// we dont want to create an instance just to dispose it
- UiEventsLogger_Impl::prepareMutex();
- Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
+ Guard<Mutex> singleton_guard(theSingletonMutex::get());
if(UiEventsLogger_Impl::instance!=UiEventsLogger_Impl::ptr())
UiEventsLogger_Impl::getInstance()->disposing();
}
void UiEventsLogger::reinit()
{
- UiEventsLogger_Impl::prepareMutex();
- Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
+ Guard<Mutex> singleton_guard(theSingletonMutex::get());
if(UiEventsLogger_Impl::instance)
{
UiEventsLogger_Impl::instance->disposing();
@@ -665,17 +662,6 @@ namespace comphelper
return instance;
}
- Mutex * UiEventsLogger_Impl::singleton_mutex = NULL;
- void UiEventsLogger_Impl::prepareMutex()
- {
- if(singleton_mutex == NULL)
- {
- Guard<Mutex> global_guard(Mutex::getGlobalMutex());
- if(singleton_mutex == NULL)
- singleton_mutex = new Mutex();
- }
- }
-
sal_Int32 UiEventsLogger_Impl::findIdx(const Sequence<PropertyValue>& args, const OUString& key)
{
for(sal_Int32 i=0; i<args.getLength(); i++)
More information about the Libreoffice-commits
mailing list