summaryrefslogtreecommitdiff
path: root/editeng/source/uno/unopracc.cxx
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-06-17 12:00:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-17 13:28:18 +0200
commitd69795b9c9d2dac7b751c6fe8b4663c0c26a129b (patch)
treee900e25a1055aa46c3b54a63bb256a82cba370c6 /editeng/source/uno/unopracc.cxx
parent76ed00f8db34490d5e21c72d142e11da510ac605 (diff)
use local statics in getTypes functions
... instead of double checked locking patterns. Change-Id: I1b86ce723ff22dd357b3ed69a52757b085472424 Reviewed-on: https://gerrit.libreoffice.org/38906 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source/uno/unopracc.cxx')
-rw-r--r--editeng/source/uno/unopracc.cxx21
1 files changed, 2 insertions, 19 deletions
diff --git a/editeng/source/uno/unopracc.cxx b/editeng/source/uno/unopracc.cxx
index a26ddd2123a2..15ad7950bc90 100644
--- a/editeng/source/uno/unopracc.cxx
+++ b/editeng/source/uno/unopracc.cxx
@@ -27,7 +27,6 @@
#include <cppuhelper/weakref.hxx>
#include <editeng/unopracc.hxx>
#include <editeng/unoedsrc.hxx>
-#include <osl/mutex.hxx>
using namespace ::com::sun::star;
@@ -67,30 +66,14 @@ void SAL_CALL SvxAccessibleTextPropertySet::release()
// XTypeProvider
uno::Sequence< uno::Type > SAL_CALL SvxAccessibleTextPropertySet::getTypes()
{
- static ::cppu::OTypeCollection* pTypeCollection = nullptr ;
-
- // double-checked locking pattern.
- if ( pTypeCollection == nullptr )
- {
- 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(
+ static ::cppu::OTypeCollection ourTypeCollection(
::cppu::UnoType<beans::XPropertySet>::get(),
::cppu::UnoType<beans::XMultiPropertySet>::get(),
::cppu::UnoType<beans::XPropertyState>::get(),
::cppu::UnoType<lang::XServiceInfo>::get(),
::cppu::UnoType<lang::XTypeProvider>::get() );
- // ... and set his address to static pointer!
- pTypeCollection = &aTypeCollection ;
- }
- }
-
- return pTypeCollection->getTypes() ;
+ return ourTypeCollection.getTypes() ;
}
uno::Sequence< sal_Int8 > SAL_CALL SvxAccessibleTextPropertySet::getImplementationId()