From d69795b9c9d2dac7b751c6fe8b4663c0c26a129b Mon Sep 17 00:00:00 2001 From: Jochen Nitschke Date: Sat, 17 Jun 2017 12:00:17 +0200 Subject: 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 Reviewed-by: Noel Grandin --- editeng/source/uno/unopracc.cxx | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'editeng/source/uno/unopracc.cxx') 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 #include #include -#include 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::get(), ::cppu::UnoType::get(), ::cppu::UnoType::get(), ::cppu::UnoType::get(), ::cppu::UnoType::get() ); - // ... and set his address to static pointer! - pTypeCollection = &aTypeCollection ; - } - } - - return pTypeCollection->getTypes() ; + return ourTypeCollection.getTypes() ; } uno::Sequence< sal_Int8 > SAL_CALL SvxAccessibleTextPropertySet::getImplementationId() -- cgit