summaryrefslogtreecommitdiff
path: root/UnoControls/source/controls/framecontrol.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'UnoControls/source/controls/framecontrol.cxx')
-rw-r--r--UnoControls/source/controls/framecontrol.cxx68
1 files changed, 13 insertions, 55 deletions
diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx
index ed9b15e2870a..e9fe0371840e 100644
--- a/UnoControls/source/controls/framecontrol.cxx
+++ b/UnoControls/source/controls/framecontrol.cxx
@@ -107,31 +107,13 @@ void SAL_CALL FrameControl::release() throw()
Sequence< Type > SAL_CALL FrameControl::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 OTypeCollection* pTypeCollection = nullptr;
+ static OTypeCollection ourTypeCollection(
+ cppu::UnoType<XControlModel>::get(),
+ cppu::UnoType<XControlContainer>::get(),
+ cppu::UnoType<XConnectionPointContainer>::get(),
+ BaseControl::getTypes() );
- if ( pTypeCollection == nullptr )
- {
- // Ready for multithreading; get global mutex for first call of this method only! see before
- MutexGuard aGuard( 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 OTypeCollection aTypeCollection ( cppu::UnoType<XControlModel>::get(),
- cppu::UnoType<XControlContainer>::get(),
- cppu::UnoType<XConnectionPointContainer>::get(),
- BaseControl::getTypes()
- );
- // ... and set his address to static pointer!
- pTypeCollection = &aTypeCollection;
- }
- }
-
- return pTypeCollection->getTypes();
+ return ourTypeCollection.getTypes();
}
// XAggregation
@@ -353,44 +335,20 @@ void FrameControl::getFastPropertyValue( Any& rRet ,
IPropertyArrayHelper& FrameControl::getInfoHelper()
{
// Create a table that map names to index values.
- static OPropertyArrayHelper* pInfo;
-
- if (!pInfo)
- {
- // global method must be guarded
- MutexGuard aGuard ( Mutex::getGlobalMutex() );
+ static OPropertyArrayHelper ourPropertyInfo( impl_getStaticPropertyDescriptor(), true );
- if (!pInfo)
- {
- pInfo = new OPropertyArrayHelper( impl_getStaticPropertyDescriptor(), true );
- }
- }
-
- return *pInfo;
+ return ourPropertyInfo;
}
// OPropertySetHelper
Reference< XPropertySetInfo > SAL_CALL FrameControl::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 )
- {
- // Ready for multithreading
- MutexGuard aGuard ( 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 ( createPropertySetInfo ( getInfoHelper () ) );
- pInfo = &xInfo;
- }
- }
- return ( *pInfo );
+ // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
+ // (Use method "getInfoHelper()".)
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+
+ return xInfo;
}
// BaseControl