sd/source/ui/accessibility/AccessibleSlideSorterView.cxx | 21 ++--- sd/source/ui/inc/AccessibleSlideSorterView.hxx | 10 -- sd/source/ui/inc/DrawSubController.hxx | 9 -- sd/source/ui/inc/SdUnoDrawView.hxx | 5 - sd/source/ui/inc/SdUnoOutlineView.hxx | 9 -- sd/source/ui/inc/SdUnoSlideView.hxx | 4 sd/source/ui/slideshow/slideshowimpl.cxx | 62 +++++++-------- sd/source/ui/slideshow/slideshowimpl.hxx | 8 - sd/source/ui/unoidl/SdUnoDrawView.cxx | 3 sd/source/ui/unoidl/SdUnoOutlineView.cxx | 7 - sd/source/ui/unoidl/SdUnoSlideView.cxx | 3 11 files changed, 59 insertions(+), 82 deletions(-)
New commits: commit b4029ccb6ab58d955c773e8452ce064b869b1740 Author: Noel Grandin <[email protected]> AuthorDate: Wed Mar 1 15:48:06 2023 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Mar 2 06:39:36 2023 +0000 BaseMutex->std::mutex in SlideShowListenerProxy Change-Id: Iab518e2cb994372b5d601c5cd569f07531499804 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148056 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 9e0db0948ba4..4648ac379b20 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -3132,8 +3132,7 @@ void PresentationSettingsEx::SetPropertyValue( std::u16string_view rProperty, co // XAnimationListener SlideShowListenerProxy::SlideShowListenerProxy( rtl::Reference< SlideshowImpl > xController, css::uno::Reference< css::presentation::XSlideShow > xSlideShow ) -: maListeners( m_aMutex ) -, mxController(std::move( xController )) +: mxController(std::move( xController )) , mxSlideShow(std::move( xSlideShow )) { } @@ -3180,21 +3179,23 @@ void SlideShowListenerProxy::removeShapeEventListener( const css::uno::Reference void SlideShowListenerProxy::addSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& xListener ) { - maListeners.addInterface(xListener); + std::unique_lock g(m_aMutex); + maListeners.addInterface(g, xListener); } void SlideShowListenerProxy::removeSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& xListener ) { - maListeners.removeInterface(xListener); + std::unique_lock g(m_aMutex); + maListeners.removeInterface(g, xListener); } void SAL_CALL SlideShowListenerProxy::beginEvent( const Reference< XAnimationNode >& xNode ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); - if( maListeners.getLength() >= 0 ) + if( maListeners.getLength(aGuard) >= 0 ) { - maListeners.forEach( + maListeners.forEach(aGuard, [&] (Reference<XAnimationListener> const& xListener) { return xListener->beginEvent(xNode); } ); @@ -3203,11 +3204,11 @@ void SAL_CALL SlideShowListenerProxy::beginEvent( const Reference< XAnimationNod void SAL_CALL SlideShowListenerProxy::endEvent( const Reference< XAnimationNode >& xNode ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); - if( maListeners.getLength() >= 0 ) + if( maListeners.getLength(aGuard) >= 0 ) { - maListeners.forEach( + maListeners.forEach(aGuard, [&] (Reference<XAnimationListener> const& xListener) { return xListener->endEvent(xNode); } ); @@ -3216,11 +3217,11 @@ void SAL_CALL SlideShowListenerProxy::endEvent( const Reference< XAnimationNode void SAL_CALL SlideShowListenerProxy::repeat( const Reference< XAnimationNode >& xNode, ::sal_Int32 nRepeat ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); - if( maListeners.getLength() >= 0 ) + if( maListeners.getLength(aGuard) >= 0 ) { - maListeners.forEach( + maListeners.forEach(aGuard, [&] (Reference<XAnimationListener> const& xListener) { return xListener->repeat(xNode, nRepeat); } ); @@ -3231,9 +3232,9 @@ void SAL_CALL SlideShowListenerProxy::repeat( const Reference< XAnimationNode >& void SAL_CALL SlideShowListenerProxy::paused( ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); - maListeners.forEach( + maListeners.forEach(aGuard, [](uno::Reference<presentation::XSlideShowListener> const& xListener) { xListener->paused(); @@ -3242,9 +3243,9 @@ void SAL_CALL SlideShowListenerProxy::paused( ) void SAL_CALL SlideShowListenerProxy::resumed( ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); - maListeners.forEach( + maListeners.forEach(aGuard, [](uno::Reference<presentation::XSlideShowListener> const& xListener) { xListener->resumed(); @@ -3253,9 +3254,9 @@ void SAL_CALL SlideShowListenerProxy::resumed( ) void SAL_CALL SlideShowListenerProxy::slideTransitionStarted( ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); - maListeners.forEach( + maListeners.forEach(aGuard, [](uno::Reference<presentation::XSlideShowListener> const& xListener) { xListener->slideTransitionStarted(); @@ -3264,9 +3265,9 @@ void SAL_CALL SlideShowListenerProxy::slideTransitionStarted( ) void SAL_CALL SlideShowListenerProxy::slideTransitionEnded( ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); - maListeners.forEach( + maListeners.forEach(aGuard, [](uno::Reference<presentation::XSlideShowListener> const& xListener) { xListener->slideTransitionEnded (); @@ -3275,9 +3276,9 @@ void SAL_CALL SlideShowListenerProxy::slideTransitionEnded( ) void SAL_CALL SlideShowListenerProxy::slideAnimationsEnded( ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); - maListeners.forEach( + maListeners.forEach(aGuard, [](uno::Reference<presentation::XSlideShowListener> const& xListener) { xListener->slideAnimationsEnded (); @@ -3287,11 +3288,11 @@ void SAL_CALL SlideShowListenerProxy::slideAnimationsEnded( ) void SlideShowListenerProxy::slideEnded(sal_Bool bReverse) { { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); - if( maListeners.getLength() >= 0 ) + if( maListeners.getLength(aGuard) >= 0 ) { - maListeners.forEach( + maListeners.forEach(aGuard, [&] (Reference<XSlideShowListener> const& xListener) { return xListener->slideEnded(bReverse); } ); @@ -3308,11 +3309,11 @@ void SlideShowListenerProxy::slideEnded(sal_Bool bReverse) void SlideShowListenerProxy::hyperLinkClicked( OUString const& aHyperLink ) { { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); - if( maListeners.getLength() >= 0 ) + if( maListeners.getLength(aGuard) >= 0 ) { - maListeners.forEach( + maListeners.forEach(aGuard, [&] (Reference<XSlideShowListener> const& xListener) { return xListener->hyperLinkClicked(aHyperLink); } ); @@ -3330,7 +3331,8 @@ void SlideShowListenerProxy::hyperLinkClicked( OUString const& aHyperLink ) void SAL_CALL SlideShowListenerProxy::disposing( const css::lang::EventObject& aDisposeEvent ) { - maListeners.disposeAndClear( aDisposeEvent ); + std::unique_lock g(m_aMutex); + maListeners.disposeAndClear( g, aDisposeEvent ); mxController.clear(); mxSlideShow.clear(); } diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index 748a1898cff8..284744799475 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -23,8 +23,7 @@ #include <sal/config.h> #include <comphelper/compbase.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/basemutex.hxx> -#include <comphelper/interfacecontainer3.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <com/sun/star/presentation/ClickAction.hpp> #include <com/sun/star/presentation/XSlideShowListener.hpp> #include <com/sun/star/presentation/XSlideShowController.hpp> @@ -80,7 +79,7 @@ struct WrappedShapeEventImpl typedef std::shared_ptr< WrappedShapeEventImpl > WrappedShapeEventImplPtr; -class SlideShowListenerProxy : private ::cppu::BaseMutex, +class SlideShowListenerProxy : public ::cppu::WeakImplHelper< css::presentation::XSlideShowListener, css::presentation::XShapeEventListener > { public: @@ -117,7 +116,8 @@ public: virtual void SAL_CALL click(const css::uno::Reference< css::drawing::XShape > & xShape, const css::awt::MouseEvent & aOriginalEvent) override; private: - ::comphelper::OInterfaceContainerHelper3<css::presentation::XSlideShowListener> maListeners; + std::mutex m_aMutex; + ::comphelper::OInterfaceContainerHelper4<css::presentation::XSlideShowListener> maListeners; rtl::Reference< SlideshowImpl > mxController; css::uno::Reference< css::presentation::XSlideShow > mxSlideShow; }; commit 64c19da4c924c45df037c075ef88d1f01a5abbe9 Author: Noel Grandin <[email protected]> AuthorDate: Wed Mar 1 15:50:33 2023 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Mar 2 06:39:31 2023 +0000 BaseMutex->std::mutex in AccessibleSlideSorterView Change-Id: I8aeb0d5ec44a938e58475368a3bf4ae60034042d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148057 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index 4c197a71279a..ae9a45ea73f4 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -113,8 +113,7 @@ private: AccessibleSlideSorterView::AccessibleSlideSorterView( ::sd::slidesorter::SlideSorter& rSlideSorter, vcl::Window* pContentWindow) - : AccessibleSlideSorterViewBase(m_aMutex), - mrSlideSorter(rSlideSorter), + : mrSlideSorter(rSlideSorter), mnClientId(0), mpContentWindow(pContentWindow) { @@ -148,7 +147,7 @@ void AccessibleSlideSorterView::FireAccessibleEvent ( } } -void SAL_CALL AccessibleSlideSorterView::disposing() +void AccessibleSlideSorterView::disposing(std::unique_lock<std::mutex>& /*rGuard*/) { if (mnClientId != 0) { @@ -162,7 +161,7 @@ AccessibleSlideSorterObject* AccessibleSlideSorterView::GetAccessibleChildImplem sal_Int32 nIndex) { AccessibleSlideSorterObject* pResult = nullptr; - ::osl::MutexGuard aGuard (m_aMutex); + std::unique_lock aGuard (m_aMutex); if (nIndex>=0 && nIndex<mpImpl->GetVisibleChildCount()) pResult = mpImpl->GetVisibleChild(nIndex); @@ -172,7 +171,7 @@ AccessibleSlideSorterObject* AccessibleSlideSorterView::GetAccessibleChildImplem void AccessibleSlideSorterView::Destroyed() { - ::osl::MutexGuard aGuard (m_aMutex); + std::unique_lock aGuard (m_aMutex); // Send a disposing to all listeners. if (mnClientId != 0) @@ -196,7 +195,7 @@ Reference<XAccessibleContext > SAL_CALL sal_Int64 SAL_CALL AccessibleSlideSorterView::getAccessibleChildCount() { ThrowIfDisposed(); - ::osl::MutexGuard aGuard (m_aMutex); + std::unique_lock aGuard (m_aMutex); return mpImpl->GetVisibleChildCount(); } @@ -204,7 +203,7 @@ Reference<XAccessible > SAL_CALL AccessibleSlideSorterView::getAccessibleChild (sal_Int64 nIndex) { ThrowIfDisposed(); - ::osl::MutexGuard aGuard (m_aMutex); + std::unique_lock aGuard (m_aMutex); if (nIndex<0 || nIndex>=mpImpl->GetVisibleChildCount()) throw lang::IndexOutOfBoundsException(); @@ -323,9 +322,9 @@ void SAL_CALL AccessibleSlideSorterView::addAccessibleEventListener( if (!rxListener.is()) return; - const osl::MutexGuard aGuard(m_aMutex); + std::unique_lock aGuard(m_aMutex); - if (rBHelper.bDisposed || rBHelper.bInDispose) + if (m_bDisposed) { uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY); rxListener->disposing (lang::EventObject (x)); @@ -345,7 +344,7 @@ void SAL_CALL AccessibleSlideSorterView::removeAccessibleEventListener( if (!rxListener.is()) return; - const osl::MutexGuard aGuard(m_aMutex); + std::unique_lock aGuard(m_aMutex); if (mnClientId == 0) return; @@ -623,7 +622,7 @@ uno::Sequence< OUString> SAL_CALL void AccessibleSlideSorterView::ThrowIfDisposed() { - if (rBHelper.bDisposed || rBHelper.bInDispose) + if (m_bDisposed) { SAL_WARN("sd", "Calling disposed object. Throwing exception:"); throw lang::DisposedException ("object has been already disposed", diff --git a/sd/source/ui/inc/AccessibleSlideSorterView.hxx b/sd/source/ui/inc/AccessibleSlideSorterView.hxx index 0cbaf62ed586..66bcc8b5ced0 100644 --- a/sd/source/ui/inc/AccessibleSlideSorterView.hxx +++ b/sd/source/ui/inc/AccessibleSlideSorterView.hxx @@ -19,8 +19,7 @@ #pragma once -#include <cppuhelper/basemutex.hxx> -#include <cppuhelper/compbase.hxx> +#include <comphelper/compbase.hxx> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/accessibility/XAccessibleComponent.hpp> @@ -38,7 +37,7 @@ namespace accessibility { class AccessibleSlideSorterObject; -typedef ::cppu::WeakComponentImplHelper< +typedef ::comphelper::WeakComponentImplHelper< css::accessibility::XAccessible, css::accessibility::XAccessibleEventBroadcaster, css::accessibility::XAccessibleContext, @@ -52,8 +51,7 @@ typedef ::cppu::WeakComponentImplHelper< accessible. */ class AccessibleSlideSorterView - : public cppu::BaseMutex, - public AccessibleSlideSorterViewBase + : public AccessibleSlideSorterViewBase { public: AccessibleSlideSorterView( @@ -74,7 +72,7 @@ public: const css::uno::Any& rOldValue, const css::uno::Any& rNewValue); - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock<std::mutex>& rGuard) override; /** Return the implementation object of the specified child. @param nIndex commit e16fab2b140f29f32e0628efb84d55f2c3ba693e Author: Noel Grandin <[email protected]> AuthorDate: Wed Mar 1 15:40:30 2023 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Mar 2 06:39:23 2023 +0000 BaseMutex->std::mutex in DrawSubControllerInterfaceBase Change-Id: Iba2bee0feeea7cd176c178ae20e6dfce1fe4af19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148055 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sd/source/ui/inc/DrawSubController.hxx b/sd/source/ui/inc/DrawSubController.hxx index d748d6378434..5748617868a5 100644 --- a/sd/source/ui/inc/DrawSubController.hxx +++ b/sd/source/ui/inc/DrawSubController.hxx @@ -21,20 +21,15 @@ #include <com/sun/star/drawing/XDrawSubController.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/compbase.hxx> +#include <comphelper/compbase.hxx> namespace sd { - class DrawSubControllerInterfaceBase : public ::cppu::WeakComponentImplHelper< + class DrawSubControllerInterfaceBase : public ::comphelper::WeakComponentImplHelper< css::drawing::XDrawSubController, css::lang::XServiceInfo > { public: - DrawSubControllerInterfaceBase( ::osl::Mutex& aMutex ) - : ::cppu::WeakComponentImplHelper< - css::drawing::XDrawSubController, - css::lang::XServiceInfo >( aMutex ) {} - // XServiceInfo virtual OUString SAL_CALL getImplementationName( ) override = 0; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override = 0; diff --git a/sd/source/ui/inc/SdUnoDrawView.hxx b/sd/source/ui/inc/SdUnoDrawView.hxx index 6b62e4cb2772..ad14dabe52ab 100644 --- a/sd/source/ui/inc/SdUnoDrawView.hxx +++ b/sd/source/ui/inc/SdUnoDrawView.hxx @@ -20,7 +20,6 @@ #pragma once #include "DrawSubController.hxx" -#include <cppuhelper/basemutex.hxx> class SdXImpressDocument; namespace com::sun::star::drawing { class XLayer; } @@ -32,9 +31,7 @@ class View; /** This class implements the DrawViewShell specific part of the controller. */ -class SdUnoDrawView final - : private cppu::BaseMutex, - public DrawSubControllerInterfaceBase +class SdUnoDrawView final : public DrawSubControllerInterfaceBase { public: SdUnoDrawView ( diff --git a/sd/source/ui/inc/SdUnoOutlineView.hxx b/sd/source/ui/inc/SdUnoOutlineView.hxx index 2789cabee6ec..cfad20ac5829 100644 --- a/sd/source/ui/inc/SdUnoOutlineView.hxx +++ b/sd/source/ui/inc/SdUnoOutlineView.hxx @@ -20,7 +20,6 @@ #pragma once #include "DrawSubController.hxx" -#include <cppuhelper/basemutex.hxx> namespace sd { @@ -29,16 +28,12 @@ class OutlineViewShell; /** This class implements the OutlineViewShell specific part of the controller. */ class SdUnoOutlineView final - : private cppu::BaseMutex, - public DrawSubControllerInterfaceBase + : public DrawSubControllerInterfaceBase { public: - SdUnoOutlineView ( - OutlineViewShell& rViewShell) noexcept; + SdUnoOutlineView (OutlineViewShell& rViewShell) noexcept; virtual ~SdUnoOutlineView() noexcept override; - virtual void SAL_CALL disposing() override; - // XSelectionSupplier virtual sal_Bool SAL_CALL select ( diff --git a/sd/source/ui/inc/SdUnoSlideView.hxx b/sd/source/ui/inc/SdUnoSlideView.hxx index 7ca40a1abed8..f9f4655adca1 100644 --- a/sd/source/ui/inc/SdUnoSlideView.hxx +++ b/sd/source/ui/inc/SdUnoSlideView.hxx @@ -20,7 +20,6 @@ #pragma once #include "DrawSubController.hxx" -#include <cppuhelper/basemutex.hxx> namespace sd::slidesorter { class SlideSorter; } namespace com::sun::star::drawing { class XDrawPage; } @@ -31,8 +30,7 @@ namespace sd { controller. */ class SdUnoSlideView final - : private cppu::BaseMutex, - public DrawSubControllerInterfaceBase + : public DrawSubControllerInterfaceBase { public: SdUnoSlideView ( diff --git a/sd/source/ui/unoidl/SdUnoDrawView.cxx b/sd/source/ui/unoidl/SdUnoDrawView.cxx index 115a58f84b31..790fb24a9cc3 100644 --- a/sd/source/ui/unoidl/SdUnoDrawView.cxx +++ b/sd/source/ui/unoidl/SdUnoDrawView.cxx @@ -51,8 +51,7 @@ namespace sd { SdUnoDrawView::SdUnoDrawView( DrawViewShell& rViewShell, View& rView) noexcept - : DrawSubControllerInterfaceBase(m_aMutex), - mrDrawViewShell(rViewShell), + : mrDrawViewShell(rViewShell), mrView(rView) { } diff --git a/sd/source/ui/unoidl/SdUnoOutlineView.cxx b/sd/source/ui/unoidl/SdUnoOutlineView.cxx index 6b98f21401ed..e2f95934d0e6 100644 --- a/sd/source/ui/unoidl/SdUnoOutlineView.cxx +++ b/sd/source/ui/unoidl/SdUnoOutlineView.cxx @@ -34,8 +34,7 @@ namespace sd { SdUnoOutlineView::SdUnoOutlineView( OutlineViewShell& rViewShell) noexcept - : DrawSubControllerInterfaceBase(m_aMutex), - mrOutlineViewShell(rViewShell) + : mrOutlineViewShell(rViewShell) { } @@ -43,10 +42,6 @@ SdUnoOutlineView::~SdUnoOutlineView() noexcept { } -void SAL_CALL SdUnoOutlineView::disposing() -{ -} - //----- XSelectionSupplier ---------------------------------------------------- sal_Bool SAL_CALL SdUnoOutlineView::select( const Any& ) diff --git a/sd/source/ui/unoidl/SdUnoSlideView.cxx b/sd/source/ui/unoidl/SdUnoSlideView.cxx index c30962ed766b..d37c5fb0a229 100644 --- a/sd/source/ui/unoidl/SdUnoSlideView.cxx +++ b/sd/source/ui/unoidl/SdUnoSlideView.cxx @@ -38,8 +38,7 @@ namespace sd { SdUnoSlideView::SdUnoSlideView ( slidesorter::SlideSorter& rSlideSorter) noexcept - : DrawSubControllerInterfaceBase(m_aMutex), - mrSlideSorter(rSlideSorter) + : mrSlideSorter(rSlideSorter) { }
