diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-04 03:12:18 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-04 18:03:09 +0100 |
commit | 41707751a60a8044d49896b0e62d9fe0e997af85 (patch) | |
tree | afaa7252c07aeca7eaf91df5cac70a214245daa0 /svtools | |
parent | a786fad56fa48f7d01c6504e7063c57178d7fb64 (diff) |
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 <mike.kaganski@collabora.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/hatchwindow/hatchwindow.cxx | 19 |
1 files changed, 3 insertions, 16 deletions
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<embed::XHatchWindow>::get(), + VCLXWindow::getTypes()); - if ( pTypeCollection == nullptr ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ; - - if ( pTypeCollection == nullptr ) - { - static ::cppu::OTypeCollection aTypeCollection( - cppu::UnoType<embed::XHatchWindow>::get(), - VCLXHatchWindow::getTypes() ); - - pTypeCollection = &aTypeCollection ; - } - } - - return pTypeCollection->getTypes() ; + return aTypeCollection.getTypes(); } uno::Sequence< sal_Int8 > SAL_CALL VCLXHatchWindow::getImplementationId() |