summaryrefslogtreecommitdiffstats
path: root/UnoControls/source/base/basecontrol.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'UnoControls/source/base/basecontrol.cxx')
-rw-r--r--UnoControls/source/base/basecontrol.cxx39
1 files changed, 10 insertions, 29 deletions
diff --git a/UnoControls/source/base/basecontrol.cxx b/UnoControls/source/base/basecontrol.cxx
index 81a79a4da107..f488113a273b 100644
--- a/UnoControls/source/base/basecontrol.cxx
+++ b/UnoControls/source/base/basecontrol.cxx
@@ -114,35 +114,16 @@ void SAL_CALL BaseControl::release() throw()
Sequence< Type > SAL_CALL BaseControl::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;
-
- 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<XPaintListener>::get(),
- cppu::UnoType<XWindowListener>::get(),
- cppu::UnoType<XView>::get(),
- cppu::UnoType<XWindow>::get(),
- cppu::UnoType<XServiceInfo>::get(),
- cppu::UnoType<XControl>::get(),
- OComponentHelper::getTypes()
- );
-
- // ... and set his address to static pointer!
- pTypeCollection = &aTypeCollection;
- }
- }
-
- return pTypeCollection->getTypes();
+ static OTypeCollection ourTypeCollection(
+ cppu::UnoType<XPaintListener>::get(),
+ cppu::UnoType<XWindowListener>::get(),
+ cppu::UnoType<XView>::get(),
+ cppu::UnoType<XWindow>::get(),
+ cppu::UnoType<XServiceInfo>::get(),
+ cppu::UnoType<XControl>::get(),
+ OComponentHelper::getTypes() );
+
+ return ourTypeCollection.getTypes();
}
// XTypeProvider