From 41707751a60a8044d49896b0e62d9fe0e997af85 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 4 Nov 2018 03:12:18 +0300 Subject: tdf#120703 PVS: V547 Get rid of mutexes to initialize function-local statics Also fix an infinite recursion when VCLXHatchWindow::getTypes() called VCLXHatchWindow::getTypes() when initializing its static. Change-Id: I19b8b1e1b367ddf636f905fb141c7690e21f67f8 Reviewed-on: https://gerrit.libreoffice.org/62825 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski --- svtools/source/hatchwindow/hatchwindow.cxx | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'svtools') diff --git a/svtools/source/hatchwindow/hatchwindow.cxx b/svtools/source/hatchwindow/hatchwindow.cxx index 0e8b4b964182..02a0c8a09780 100644 --- a/svtools/source/hatchwindow/hatchwindow.cxx +++ b/svtools/source/hatchwindow/hatchwindow.cxx @@ -139,23 +139,10 @@ void SAL_CALL VCLXHatchWindow::release() uno::Sequence< uno::Type > SAL_CALL VCLXHatchWindow::getTypes() { - static ::cppu::OTypeCollection* pTypeCollection = nullptr ; + static cppu::OTypeCollection aTypeCollection(cppu::UnoType::get(), + VCLXWindow::getTypes()); - if ( pTypeCollection == nullptr ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ; - - if ( pTypeCollection == nullptr ) - { - static ::cppu::OTypeCollection aTypeCollection( - cppu::UnoType::get(), - VCLXHatchWindow::getTypes() ); - - pTypeCollection = &aTypeCollection ; - } - } - - return pTypeCollection->getTypes() ; + return aTypeCollection.getTypes(); } uno::Sequence< sal_Int8 > SAL_CALL VCLXHatchWindow::getImplementationId() -- cgit