sd/source/ui/accessibility/AccessibleSlideSorterView.cxx |   22 +++++++--------
 sd/source/ui/framework/tools/FrameworkHelper.cxx         |   15 ++--------
 sd/source/ui/inc/AccessibleSlideSorterView.hxx           |   12 +++-----
 3 files changed, 20 insertions(+), 29 deletions(-)

New commits:
commit 2d541dedde4ec516eacd7669bdc3ed8fb6fc2548
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Dec 28 20:00:50 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Dec 29 07:13:55 2021 +0100

    use comphelper::WeakComponentImplHelper in AccessibleSlideSorterView
    
    Change-Id: Id8e49fde253fd79eeae142d9fd7069fd8c3a9035
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127653
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx 
b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index 87eea89d2199..b4f7d79d6ead 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -47,6 +47,7 @@
 #include <rtl/ref.hxx>
 #include <sal/log.hxx>
 #include <i18nlangtag/languagetag.hxx>
+#include <osl/diagnose.h>
 
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
@@ -114,8 +115,7 @@ private:
 AccessibleSlideSorterView::AccessibleSlideSorterView(
     ::sd::slidesorter::SlideSorter& rSlideSorter,
     vcl::Window* pContentWindow)
-    : AccessibleSlideSorterViewBase(m_aMutex),
-      mrSlideSorter(rSlideSorter),
+    : mrSlideSorter(rSlideSorter),
       mnClientId(0),
       mpContentWindow(pContentWindow)
 {
@@ -149,7 +149,7 @@ void AccessibleSlideSorterView::FireAccessibleEvent (
     }
 }
 
-void SAL_CALL AccessibleSlideSorterView::disposing()
+void AccessibleSlideSorterView::disposing(std::unique_lock<std::mutex>&)
 {
     if (mnClientId != 0)
     {
@@ -163,7 +163,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);
@@ -173,7 +173,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)
@@ -197,7 +197,7 @@ Reference<XAccessibleContext > SAL_CALL
 sal_Int32 SAL_CALL AccessibleSlideSorterView::getAccessibleChildCount()
 {
     ThrowIfDisposed();
-    ::osl::MutexGuard aGuard (m_aMutex);
+    std::unique_lock aGuard (m_aMutex);
     return mpImpl->GetVisibleChildCount();
 }
 
@@ -205,7 +205,7 @@ Reference<XAccessible > SAL_CALL
     AccessibleSlideSorterView::getAccessibleChild (sal_Int32 nIndex)
 {
     ThrowIfDisposed();
-    ::osl::MutexGuard aGuard (m_aMutex);
+    std::unique_lock aGuard (m_aMutex);
 
     if (nIndex<0 || nIndex>=mpImpl->GetVisibleChildCount())
         throw lang::IndexOutOfBoundsException();
@@ -325,9 +325,9 @@ void SAL_CALL 
AccessibleSlideSorterView::addAccessibleEventListener(
     if (!rxListener.is())
         return;
 
-    const osl::MutexGuard aGuard(m_aMutex);
+    const 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));
@@ -347,7 +347,7 @@ void SAL_CALL 
AccessibleSlideSorterView::removeAccessibleEventListener(
     if (!rxListener.is())
         return;
 
-    const osl::MutexGuard aGuard(m_aMutex);
+    const std::unique_lock aGuard(m_aMutex);
 
     if (mnClientId == 0)
         return;
@@ -612,7 +612,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 85003b72d138..b547f7e51432 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,
@@ -51,9 +50,8 @@ typedef ::cppu::WeakComponentImplHelper<
     of the AccessibleSlideSorterObject class to the make the page objects
     accessible.
 */
-class AccessibleSlideSorterView
-    : public cppu::BaseMutex,
-      public AccessibleSlideSorterViewBase
+class AccessibleSlideSorterView final
+    : 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>&) override;
 
     /** Return the implementation object of the specified child.
         @param nIndex
commit 03ce2a8ec6bdf6740bc1a54e52fc57d033060d0f
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Dec 28 20:04:31 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Dec 29 07:13:43 2021 +0100

    use comphelper::WeakComponentImplHelper in LifetimeController
    
    Change-Id: Id3d9e766fbe2f3707946c0ac2f1c25319685c515
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127655
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx 
b/sd/source/ui/framework/tools/FrameworkHelper.cxx
index 61ba1b26ba02..b3d84f923249 100644
--- a/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -107,7 +107,7 @@ private:
 
 //----- LifetimeController ----------------------------------------------------
 
-typedef ::cppu::WeakComponentImplHelper <
+typedef comphelper::WeakComponentImplHelper <
     css::lang::XEventListener
     > LifetimeControllerInterfaceBase;
 
@@ -117,19 +117,17 @@ typedef ::cppu::WeakComponentImplHelper <
     one of them and Release() when both of them are destroyed.
 */
 class LifetimeController
-    : public cppu::BaseMutex,
-      public LifetimeControllerInterfaceBase,
+    : public LifetimeControllerInterfaceBase,
       public SfxListener
 {
 public:
     explicit LifetimeController (::sd::ViewShellBase& rBase);
     virtual ~LifetimeController() override;
 
-    virtual void SAL_CALL disposing() override;
-
     /** XEventListener.  This method is called when the frame::XController
         is being destroyed.
     */
+    using WeakComponentImplHelperBase::disposing;
     virtual void SAL_CALL disposing (const lang::EventObject& rEvent) override;
 
     /** This method is called when the ViewShellBase is being destroyed.
@@ -889,8 +887,7 @@ void SAL_CALL CallbackCaller::notifyConfigurationChange (
 //----- LifetimeController -------------------------------------------------
 
 LifetimeController::LifetimeController (::sd::ViewShellBase& rBase)
-    : LifetimeControllerInterfaceBase(m_aMutex),
-      mrBase(rBase),
+    : mrBase(rBase),
       mbListeningToViewShellBase(false),
       mbListeningToController(false)
 {
@@ -916,10 +913,6 @@ LifetimeController::~LifetimeController()
     OSL_ASSERT(!mbListeningToController && !mbListeningToViewShellBase);
 }
 
-void LifetimeController::disposing()
-{
-}
-
 void SAL_CALL LifetimeController::disposing (const lang::EventObject&)
 {
     mbListeningToController = false;

Reply via email to