summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-06-07 19:42:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-08 09:01:42 +0200
commite4f6840d0968ff9ea8976fdd735e1ecfe266cdde (patch)
treeb6c45864f12504ef1da180a38ebb0872c52d268b /framework
parent93d6a7ca515909c657224cb2f8d5397c376b8017 (diff)
framework: replace double checked locking patterns
with thread safe local statics. Change-Id: I660f6a899d1821bab627ed4972c4fc0d40610de2 Reviewed-on: https://gerrit.libreoffice.org/38541 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/macros/xtypeprovider.hxx31
-rw-r--r--framework/source/fwe/classes/actiontriggercontainer.cxx24
-rw-r--r--framework/source/fwe/classes/actiontriggerpropertyset.cxx69
-rw-r--r--framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx70
-rw-r--r--framework/source/fwe/classes/addonsoptions.cxx22
-rw-r--r--framework/source/fwe/classes/rootactiontriggercontainer.cxx25
-rw-r--r--framework/source/fwi/uielement/constitemcontainer.cxx49
-rw-r--r--framework/source/fwi/uielement/rootitemcontainer.cxx49
-rw-r--r--framework/source/helper/uiconfigelementwrapperbase.cxx49
-rw-r--r--framework/source/helper/uielementwrapperbase.cxx49
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx15
-rw-r--r--framework/source/services/autorecovery.cxx26
-rw-r--r--framework/source/services/desktop.cxx23
-rw-r--r--framework/source/tabwin/tabwindow.cxx49
14 files changed, 95 insertions, 455 deletions
diff --git a/framework/inc/macros/xtypeprovider.hxx b/framework/inc/macros/xtypeprovider.hxx
index 473e7704869d..27f9a0546b93 100644
--- a/framework/inc/macros/xtypeprovider.hxx
+++ b/framework/inc/macros/xtypeprovider.hxx
@@ -25,7 +25,6 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Type.hxx>
#include <cppuhelper/typeprovider.hxx>
-#include <osl/mutex.hxx>
namespace framework{
@@ -73,31 +72,13 @@ ________________________________________________________________________________
// private
// complete implementation of XTypeProvider with max. 12 interfaces!
-#define PRIVATE_DEFINE_XTYPEPROVIDER( CLASS, TYPES ) \
- PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \
+#define PRIVATE_DEFINE_XTYPEPROVIDER( CLASS, TYPES ) \
+ PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \
css::uno::Sequence< css::uno::Type > SAL_CALL CLASS::getTypes() \
- { \
- /* Optimize this method ! */ \
- /* We initialize a static variable only one time. */ \
- /* And we don't must use a mutex at every call! */ \
- /* For the first call; pTypeCollection is NULL - */ \
- /* for the second call pTypeCollection is different from NULL! */ \
- static ::cppu::OTypeCollection* pTypeCollection = nullptr; \
- if ( pTypeCollection == nullptr ) \
- { \
- /* Ready for multithreading; get global mutex for first call of this method only! see before */ \
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \
- /* Control these pointer again ... it can be, that another instance will be faster then these! */ \
- if ( pTypeCollection == nullptr ) \
- { \
- /* Create a static typecollection ... */ \
- /* Attention: "TYPES" will expand to "(...)"! */ \
- static ::cppu::OTypeCollection aTypeCollection TYPES; \
- /* ... and set his address to static pointer! */ \
- pTypeCollection = &aTypeCollection; \
- } \
- } \
- return pTypeCollection->getTypes(); \
+ { \
+ /* Attention: "TYPES" will expand to "(...)"! */ \
+ static cppu::OTypeCollection ourTypeCollection TYPES; \
+ return ourTypeCollection.getTypes(); \
}
// public
diff --git a/framework/source/fwe/classes/actiontriggercontainer.cxx b/framework/source/fwe/classes/actiontriggercontainer.cxx
index 71a6d4532047..442ccc85e8fd 100644
--- a/framework/source/fwe/classes/actiontriggercontainer.cxx
+++ b/framework/source/fwe/classes/actiontriggercontainer.cxx
@@ -117,32 +117,14 @@ Sequence< OUString > SAL_CALL ActionTriggerContainer::getSupportedServiceNames()
// XTypeProvider
Sequence< Type > SAL_CALL ActionTriggerContainer::getTypes()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
- static ::cppu::OTypeCollection* pTypeCollection = nullptr;
-
- if ( pTypeCollection == nullptr )
- {
- // Ready for multithreading; get global mutex for first call of this method only! see before
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
-
- // Control these pointer again ... it can be, that another instance will be faster then these!
- if ( pTypeCollection == nullptr )
- {
- // Create a static typecollection ...
- static ::cppu::OTypeCollection aTypeCollection(
+ // Create a static typecollection ...
+ static ::cppu::OTypeCollection ourTypeCollection(
cppu::UnoType<XMultiServiceFactory>::get(),
cppu::UnoType<XIndexContainer>::get(),
cppu::UnoType<XServiceInfo>::get(),
cppu::UnoType<XTypeProvider>::get());
- // ... and set his address to static pointer!
- pTypeCollection = &aTypeCollection;
- }
- }
-
- return pTypeCollection->getTypes();
+ return ourTypeCollection.getTypes();
}
Sequence< sal_Int8 > SAL_CALL ActionTriggerContainer::getImplementationId()
diff --git a/framework/source/fwe/classes/actiontriggerpropertyset.cxx b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
index 40043c1d8e96..4ded47739217 100644
--- a/framework/source/fwe/classes/actiontriggerpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
@@ -115,33 +115,16 @@ Sequence< OUString > SAL_CALL ActionTriggerPropertySet::getSupportedServiceNames
// XTypeProvider
Sequence< Type > SAL_CALL ActionTriggerPropertySet::getTypes()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
- static ::cppu::OTypeCollection* pTypeCollection = nullptr;
-
- if ( pTypeCollection == nullptr )
- {
- // Ready for multithreading; get global mutex for first call of this method only! see before
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
-
- // Control these pointer again ... it can be, that another instance will be faster then these!
- if ( pTypeCollection == nullptr )
- {
- // Create a static typecollection ...
- static ::cppu::OTypeCollection aTypeCollection(
+ // Create a static typecollection ...
+ static ::cppu::OTypeCollection ourTypeCollection(
cppu::UnoType<XPropertySet>::get(),
cppu::UnoType<XFastPropertySet>::get(),
cppu::UnoType<XMultiPropertySet>::get(),
cppu::UnoType<XServiceInfo>::get(),
cppu::UnoType<XTypeProvider>::get());
- // ... and set his address to static pointer!
- pTypeCollection = &aTypeCollection;
- }
- }
- return pTypeCollection->getTypes();
+ return ourTypeCollection.getTypes();
}
Sequence< sal_Int8 > SAL_CALL ActionTriggerPropertySet::getImplementationId()
@@ -251,49 +234,21 @@ void SAL_CALL ActionTriggerPropertySet::getFastPropertyValue(
::cppu::IPropertyArrayHelper& SAL_CALL ActionTriggerPropertySet::getInfoHelper()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
- static OPropertyArrayHelper* pInfoHelper = nullptr;
+ // Define static member to give structure of properties to baseclass "OPropertySetHelper".
+ // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
+ // "true" say: Table is sorted by name.
+ static OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
- if( pInfoHelper == nullptr )
- {
- SolarMutexGuard aGuard;
- // Control this pointer again, another instance can be faster then these!
- if( pInfoHelper == nullptr )
- {
- // Define static member to give structure of properties to baseclass "OPropertySetHelper".
- // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
- // "sal_True" say: Table is sorted by name.
- static OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
- pInfoHelper = &aInfoHelper;
- }
- }
-
- return (*pInfoHelper);
+ return ourInfoHelper;
}
Reference< XPropertySetInfo > SAL_CALL ActionTriggerPropertySet::getPropertySetInfo()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
- static Reference< XPropertySetInfo >* pInfo = nullptr;
-
- if( pInfo == nullptr )
- {
- SolarMutexGuard aGuard;
- // Control this pointer again, another instance can be faster then these!
- if( pInfo == nullptr )
- {
- // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
- // (Use method "getInfoHelper()".)
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- pInfo = &xInfo;
- }
- }
+ // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
+ // (Use method "getInfoHelper()".)
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return (*pInfo);
+ return xInfo;
}
const Sequence< Property > ActionTriggerPropertySet::impl_getStaticPropertyDescriptor()
diff --git a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
index ca2ec4f88813..cfeb395b5619 100644
--- a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
@@ -108,33 +108,15 @@ Sequence< OUString > SAL_CALL ActionTriggerSeparatorPropertySet::getSupportedSer
// XTypeProvider
Sequence< Type > SAL_CALL ActionTriggerSeparatorPropertySet::getTypes()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
- static ::cppu::OTypeCollection* pTypeCollection = nullptr;
-
- if ( pTypeCollection == nullptr )
- {
- // Ready for multithreading; get global mutex for first call of this method only! see before
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
-
- // Control these pointer again ... it can be, that another instance will be faster then these!
- if ( pTypeCollection == nullptr )
- {
- // Create a static typecollection ...
- static ::cppu::OTypeCollection aTypeCollection(
+ // Create a static typecollection ...
+ static ::cppu::OTypeCollection ourTypeCollection(
cppu::UnoType<XPropertySet>::get(),
cppu::UnoType<XFastPropertySet>::get(),
cppu::UnoType<XMultiPropertySet>::get(),
cppu::UnoType<XServiceInfo>::get(),
cppu::UnoType<XTypeProvider>::get());
- // ... and set his address to static pointer!
- pTypeCollection = &aTypeCollection;
- }
- }
-
- return pTypeCollection->getTypes();
+ return ourTypeCollection.getTypes();
}
Sequence< sal_Int8 > SAL_CALL ActionTriggerSeparatorPropertySet::getImplementationId()
@@ -196,49 +178,21 @@ void SAL_CALL ActionTriggerSeparatorPropertySet::getFastPropertyValue(
::cppu::IPropertyArrayHelper& SAL_CALL ActionTriggerSeparatorPropertySet::getInfoHelper()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
- static OPropertyArrayHelper* pInfoHelper = nullptr;
-
- if( pInfoHelper == nullptr )
- {
- SolarMutexGuard aGuard;
- // Control this pointer again, another instance can be faster then these!
- if( pInfoHelper == nullptr )
- {
- // Define static member to give structure of properties to baseclass "OPropertySetHelper".
- // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
- // "sal_True" say: Table is sorted by name.
- static OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
- pInfoHelper = &aInfoHelper;
- }
- }
+ // Define static member to give structure of properties to baseclass "OPropertySetHelper".
+ // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
+ // "rrue" say: Table is sorted by name.
+ static OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
- return (*pInfoHelper);
+ return ourInfoHelper;
}
Reference< XPropertySetInfo > SAL_CALL ActionTriggerSeparatorPropertySet::getPropertySetInfo()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
- static Reference< XPropertySetInfo >* pInfo = nullptr;
-
- if( pInfo == nullptr )
- {
- SolarMutexGuard aGuard;
- // Control this pointer again, another instance can be faster then these!
- if( pInfo == nullptr )
- {
- // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
- // (Use method "getInfoHelper()".)
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- pInfo = &xInfo;
- }
- }
+ // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
+ // (Use method "getInfoHelper()".)
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return (*pInfo);
+ return xInfo;
}
const Sequence< Property > ActionTriggerSeparatorPropertySet::impl_getStaticPropertyDescriptor()
diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx
index adcf8b8b827f..d1fdd111e595 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -1594,24 +1594,10 @@ Image AddonsOptions::GetImageFromURL( const OUString& aURL, bool bBig ) const
Mutex& AddonsOptions::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;
+ // Create static mutex variable.
+ static Mutex ourMutex;
+
+ return ourMutex;
}
IMPL_LINK_NOARG(AddonsOptions_Impl, NotifyEvent, void*, void)
diff --git a/framework/source/fwe/classes/rootactiontriggercontainer.cxx b/framework/source/fwe/classes/rootactiontriggercontainer.cxx
index c1306b33dfd5..ef495b486cef 100644
--- a/framework/source/fwe/classes/rootactiontriggercontainer.cxx
+++ b/framework/source/fwe/classes/rootactiontriggercontainer.cxx
@@ -25,7 +25,6 @@
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <framework/actiontriggerhelper.hxx>
-#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
using namespace cppu;
@@ -231,21 +230,8 @@ sal_Int64 SAL_CALL RootActionTriggerContainer::getSomething( const Sequence< sal
// XTypeProvider
Sequence< Type > SAL_CALL RootActionTriggerContainer::getTypes()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
- static ::cppu::OTypeCollection* pTypeCollection = nullptr;
-
- if ( pTypeCollection == nullptr )
- {
- // Ready for multithreading; get global mutex for first call of this method only! see before
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
-
- // Control these pointer again ... it can be, that another instance will be faster then these!
- if ( pTypeCollection == nullptr )
- {
- // Create a static typecollection ...
- static ::cppu::OTypeCollection aTypeCollection(
+ // Create a static typecollection ...
+ static ::cppu::OTypeCollection ourTypeCollection(
cppu::UnoType<XMultiServiceFactory>::get(),
cppu::UnoType<XIndexContainer>::get(),
cppu::UnoType<XServiceInfo>::get(),
@@ -253,12 +239,7 @@ Sequence< Type > SAL_CALL RootActionTriggerContainer::getTypes()
cppu::UnoType<XUnoTunnel>::get(),
cppu::UnoType<XNamed>::get());
- // ... and set his address to static pointer!
- pTypeCollection = &aTypeCollection;
- }
- }
-
- return pTypeCollection->getTypes();
+ return ourTypeCollection.getTypes();
}
Sequence< sal_Int8 > SAL_CALL RootActionTriggerContainer::getImplementationId()
diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx b/framework/source/fwi/uielement/constitemcontainer.cxx
index 10018c7c978c..811e33ba89cb 100644
--- a/framework/source/fwi/uielement/constitemcontainer.cxx
+++ b/framework/source/fwi/uielement/constitemcontainer.cxx
@@ -213,26 +213,11 @@ Any SAL_CALL ConstItemContainer::getByIndex( sal_Int32 Index )
// XPropertySet
Reference< XPropertySetInfo > SAL_CALL ConstItemContainer::getPropertySetInfo()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
- static Reference< XPropertySetInfo >* pInfo = nullptr;
+ // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
+ // (Use method "getInfoHelper()".)
+ static Reference< XPropertySetInfo > xInfo(new comphelper::PropertySetInfo(getInfoHelper().getProperties()));
- if( pInfo == nullptr )
- {
- // Ready for multithreading
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
- // Control this pointer again, another instance can be faster then these!
- if( pInfo == nullptr )
- {
- // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
- // (Use method "getInfoHelper()".)
- static Reference< XPropertySetInfo > xInfo = new ::comphelper::PropertySetInfo(getInfoHelper().getProperties());
- pInfo = &xInfo;
- }
- }
-
- return (*pInfo);
+ return xInfo;
}
void SAL_CALL ConstItemContainer::setPropertyValue( const OUString&, const Any& )
@@ -281,28 +266,12 @@ Any SAL_CALL ConstItemContainer::getFastPropertyValue( sal_Int32 nHandle )
::cppu::IPropertyArrayHelper& SAL_CALL ConstItemContainer::getInfoHelper()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
- static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
-
- if( pInfoHelper == nullptr )
- {
- // Ready for multithreading
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
-
- // Control this pointer again, another instance can be faster then these!
- if( pInfoHelper == nullptr )
- {
- // Define static member to give structure of properties to baseclass "OPropertySetHelper".
- // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
- // "sal_True" say: Table is sorted by name.
- static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
- pInfoHelper = &aInfoHelper;
- }
- }
+ // Define static member to give structure of properties to baseclass "OPropertySetHelper".
+ // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
+ // "true" say: Table is sorted by name.
+ static ::cppu::OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
- return(*pInfoHelper);
+ return ourInfoHelper;
}
const css::uno::Sequence< css::beans::Property > ConstItemContainer::impl_getStaticPropertyDescriptor()
diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx
index 04d085deccf9..8d9f4f130b5a 100644
--- a/framework/source/fwi/uielement/rootitemcontainer.cxx
+++ b/framework/source/fwi/uielement/rootitemcontainer.cxx
@@ -295,52 +295,21 @@ void SAL_CALL RootItemContainer::getFastPropertyValue( css::uno::Any& aValue ,
::cppu::IPropertyArrayHelper& SAL_CALL RootItemContainer::getInfoHelper()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
- static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
+ // Define static member to give structure of properties to baseclass "OPropertySetHelper".
+ // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
+ // "true" say: Table is sorted by name.
+ static ::cppu::OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
- if( pInfoHelper == nullptr )
- {
- // Ready for multithreading
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
-
- // Control this pointer again, another instance can be faster then these!
- if( pInfoHelper == nullptr )
- {
- // Define static member to give structure of properties to baseclass "OPropertySetHelper".
- // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
- // "sal_True" say: Table is sorted by name.
- static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
- pInfoHelper = &aInfoHelper;
- }
- }
-
- return(*pInfoHelper);
+ return ourInfoHelper;
}
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL RootItemContainer::getPropertySetInfo()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
- static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
-
- if( pInfo == nullptr )
- {
- // Ready for multithreading
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
- // Control this pointer again, another instance can be faster then these!
- if( pInfo == nullptr )
- {
- // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
- // (Use method "getInfoHelper()".)
- static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- pInfo = &xInfo;
- }
- }
+ // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
+ // (Use method "getInfoHelper()".)
+ static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return (*pInfo);
+ return xInfo;
}
const css::uno::Sequence< css::beans::Property > RootItemContainer::impl_getStaticPropertyDescriptor()
diff --git a/framework/source/helper/uiconfigelementwrapperbase.cxx b/framework/source/helper/uiconfigelementwrapperbase.cxx
index f7ce2a1e1705..4c16ffe18890 100644
--- a/framework/source/helper/uiconfigelementwrapperbase.cxx
+++ b/framework/source/helper/uiconfigelementwrapperbase.cxx
@@ -373,52 +373,21 @@ void SAL_CALL UIConfigElementWrapperBase::getFastPropertyValue( css::uno::Any& a
::cppu::IPropertyArrayHelper& SAL_CALL UIConfigElementWrapperBase::getInfoHelper()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
- static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
+ // Define static member to give structure of properties to baseclass "OPropertySetHelper".
+ // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
+ // "true" say: Table is sorted by name.
+ static ::cppu::OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
- if( pInfoHelper == nullptr )
- {
- // Ready for multithreading
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
-
- // Control this pointer again, another instance can be faster then these!
- if( pInfoHelper == nullptr )
- {
- // Define static member to give structure of properties to baseclass "OPropertySetHelper".
- // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
- // "sal_True" say: Table is sorted by name.
- static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
- pInfoHelper = &aInfoHelper;
- }
- }
-
- return(*pInfoHelper);
+ return ourInfoHelper;
}
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL UIConfigElementWrapperBase::getPropertySetInfo()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
- static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
-
- if( pInfo == nullptr )
- {
- // Ready for multithreading
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
- // Control this pointer again, another instance can be faster then these!
- if( pInfo == nullptr )
- {
- // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
- // (Use method "getInfoHelper()".)
- static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- pInfo = &xInfo;
- }
- }
+ // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
+ // (Use method "getInfoHelper()".)
+ static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return (*pInfo);
+ return xInfo;
}
const css::uno::Sequence< css::beans::Property > UIConfigElementWrapperBase::impl_getStaticPropertyDescriptor()
diff --git a/framework/source/helper/uielementwrapperbase.cxx b/framework/source/helper/uielementwrapperbase.cxx
index d50ce5a32953..001675e62c48 100644
--- a/framework/source/helper/uielementwrapperbase.cxx
+++ b/framework/source/helper/uielementwrapperbase.cxx
@@ -168,52 +168,21 @@ void SAL_CALL UIElementWrapperBase::getFastPropertyValue( css::uno::Any& aValue
::cppu::IPropertyArrayHelper& SAL_CALL UIElementWrapperBase::getInfoHelper()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
- static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
+ // Define static member to give structure of properties to baseclass "OPropertySetHelper".
+ // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
+ // "true" say: Table is sorted by name.
+ static ::cppu::OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
- if( pInfoHelper == nullptr )
- {
- // Ready for multithreading
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
-
- // Control this pointer again, another instance can be faster then these!
- if( pInfoHelper == nullptr )
- {
- // Define static member to give structure of properties to baseclass "OPropertySetHelper".
- // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
- // "sal_True" say: Table is sorted by name.
- static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
- pInfoHelper = &aInfoHelper;
- }
- }
-
- return(*pInfoHelper);
+ return ourInfoHelper;
}
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL UIElementWrapperBase::getPropertySetInfo()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
- static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
-
- if( pInfo == nullptr )
- {
- // Ready for multithreading
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
- // Control this pointer again, another instance can be faster then these!
- if( pInfo == nullptr )
- {
- // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
- // (Use method "getInfoHelper()".)
- static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- pInfo = &xInfo;
- }
- }
+ // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
+ // (Use method "getInfoHelper()".)
+ static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return (*pInfo);
+ return xInfo;
}
const css::uno::Sequence< css::beans::Property > UIElementWrapperBase::impl_getStaticPropertyDescriptor()
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 8cc14fddf5ee..14364f7c6c2b 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -3109,20 +3109,9 @@ namespace
uno::Reference< beans::XPropertySetInfo > SAL_CALL LayoutManager::getPropertySetInfo()
{
- static uno::Reference< beans::XPropertySetInfo >* pInfo = nullptr;
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- if( pInfo == nullptr )
- {
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
-
- if( pInfo == nullptr )
- {
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- pInfo = &xInfo;
- }
- }
-
- return (*pInfo);
+ return xInfo;
}
} // namespace framework
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 48cb5bad7861..2a6ceb707af1 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -4024,35 +4024,17 @@ const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescripto
::cppu::IPropertyArrayHelper& SAL_CALL AutoRecovery::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
- if(!pInfoHelper)
- {
- SolarMutexGuard g;
- if(!pInfoHelper)
- {
- static ::cppu::OPropertyArrayHelper aInfoHelper(impl_getStaticPropertyDescriptor(), true);
- pInfoHelper = &aInfoHelper;
- }
- }
+ static ::cppu::OPropertyArrayHelper ourInfoHelper(impl_getStaticPropertyDescriptor(), true);
- return (*pInfoHelper);
+ return ourInfoHelper;
}
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL AutoRecovery::getPropertySetInfo()
{
- static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
- if(!pInfo)
- {
- SolarMutexGuard g;
- if(!pInfo)
- {
- static css::uno::Reference< css::beans::XPropertySetInfo > xInfo(
+ static css::uno::Reference< css::beans::XPropertySetInfo > xInfo(
::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()));
- pInfo = &xInfo;
- }
- }
- return (*pInfo);
+ return xInfo;
}
void AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList()
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 1791e857f4ec..be8b18f8a48b 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -1507,27 +1507,12 @@ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL Desktop::getPropert
// Register transaction and reject wrong calls.
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
- static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
-
- if( pInfo == nullptr )
- {
- SolarMutexGuard aGuard;
-
- // Control this pointer again, another instance can be faster then these!
- if( pInfo == nullptr )
- {
- // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
- // (Use method "getInfoHelper()".)
- static css::uno::Reference< css::beans::XPropertySetInfo > xInfo(
+ // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
+ // (Use method "getInfoHelper()".)
+ static css::uno::Reference< css::beans::XPropertySetInfo > xInfo(
cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ) );
- pInfo = &xInfo;
- }
- }
- return (*pInfo);
+ return xInfo;
}
/*-************************************************************************************************************
diff --git a/framework/source/tabwin/tabwindow.cxx b/framework/source/tabwin/tabwindow.cxx
index 56007e6ed91e..866662d5334b 100644
--- a/framework/source/tabwin/tabwindow.cxx
+++ b/framework/source/tabwin/tabwindow.cxx
@@ -818,52 +818,21 @@ void SAL_CALL TabWindow::getFastPropertyValue( css::uno::Any& aValue ,
::cppu::IPropertyArrayHelper& SAL_CALL TabWindow::getInfoHelper()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
- static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
+ // Define static member to give structure of properties to baseclass "OPropertySetHelper".
+ // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
+ // "true" say: Table is sorted by name.
+ static ::cppu::OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
- if( pInfoHelper == nullptr )
- {
- // Ready for multithreading
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
-
- // Control this pointer again, another instance can be faster then these!
- if( pInfoHelper == nullptr )
- {
- // Define static member to give structure of properties to baseclass "OPropertySetHelper".
- // "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
- // "sal_True" say: Table is sorted by name.
- static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
- pInfoHelper = &aInfoHelper;
- }
- }
-
- return(*pInfoHelper);
+ return ourInfoHelper;
}
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL TabWindow::getPropertySetInfo()
{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
- static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
-
- if( pInfo == nullptr )
- {
- // Ready for multithreading
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
- // Control this pointer again, another instance can be faster then these!
- if( pInfo == nullptr )
- {
- // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
- // (Use method "getInfoHelper()".)
- static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- pInfo = &xInfo;
- }
- }
+ // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
+ // (Use method "getInfoHelper()".)
+ static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return (*pInfo);
+ return xInfo;
}
const css::uno::Sequence< css::beans::Property > TabWindow::impl_getStaticPropertyDescriptor()