diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-20 13:11:36 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-20 13:50:57 +0000 |
commit | 00867a1833899d70581d4e35b0feb4b8fc66e5b7 (patch) | |
tree | 21d216ea34360e21af59de7b731f00c8a38caea0 /sd | |
parent | 227ea92266c03adb5faba869c64fa316ebff89f6 (diff) |
osl::Mutex->std::mutex in SdXCustomPresentation
Change-Id: I114c2b4be39eb9a40871b7f4eb073a548191a876
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147322
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/unoidl/unocpres.cxx | 13 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unocpres.hxx | 6 |
2 files changed, 11 insertions, 8 deletions
diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx index 13a634f289b4..fa329df6f74b 100644 --- a/sd/source/ui/unoidl/unocpres.cxx +++ b/sd/source/ui/unoidl/unocpres.cxx @@ -43,14 +43,12 @@ uno::Reference< uno::XInterface > createUnoCustomShow( SdCustomShow* pShow ) SdXCustomPresentation::SdXCustomPresentation() noexcept : mpSdCustomShow(nullptr), mpModel(nullptr), - aDisposeListeners( aDisposeContainerMutex ), bDisposing( false ) { } SdXCustomPresentation::SdXCustomPresentation( SdCustomShow* pShow) noexcept : mpSdCustomShow(pShow), mpModel(nullptr), - aDisposeListeners( aDisposeContainerMutex ), bDisposing( false ) { } @@ -233,9 +231,10 @@ void SAL_CALL SdXCustomPresentation::dispose() uno::Reference< uno::XInterface > xSource( static_cast<cppu::OWeakObject*>(this) ); + std::unique_lock aGuard2(aDisposeContainerMutex); lang::EventObject aEvt; aEvt.Source = xSource; - aDisposeListeners.disposeAndClear(aEvt); + aDisposeListeners.disposeAndClear(aGuard2, aEvt); mpSdCustomShow = nullptr; } @@ -245,13 +244,17 @@ void SAL_CALL SdXCustomPresentation::addEventListener( const uno::Reference< lan if( bDisposing ) throw lang::DisposedException(); - aDisposeListeners.addInterface(xListener); + std::unique_lock aGuard(aDisposeContainerMutex); + aDisposeListeners.addInterface(aGuard, xListener); } void SAL_CALL SdXCustomPresentation::removeEventListener( const uno::Reference< lang::XEventListener >& aListener ) { if( !bDisposing ) - aDisposeListeners.removeInterface(aListener); + { + std::unique_lock aGuard(aDisposeContainerMutex); + aDisposeListeners.removeInterface(aGuard, aListener); + } } /*===========================================================================* diff --git a/sd/source/ui/unoidl/unocpres.hxx b/sd/source/ui/unoidl/unocpres.hxx index fba0f5fa5002..e74dbe0e4436 100644 --- a/sd/source/ui/unoidl/unocpres.hxx +++ b/sd/source/ui/unoidl/unocpres.hxx @@ -22,7 +22,7 @@ #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <comphelper/interfacecontainer3.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <osl/mutex.hxx> #include <cppuhelper/implbase.hxx> @@ -46,8 +46,8 @@ private: SdXImpressDocument* mpModel; // for xComponent - ::osl::Mutex aDisposeContainerMutex; - ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> aDisposeListeners; + std::mutex aDisposeContainerMutex; + ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> aDisposeListeners; bool bDisposing; public: |