sd/source/ui/inc/tools/SlotStateListener.hxx |   11 +++++------
 sd/source/ui/tools/SlotStateListener.cxx     |    9 ++++-----
 2 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit fda744bcc89a767ce6270e441cab9fcfda2a97d7
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Dec 28 14:57:58 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Dec 29 07:55:44 2021 +0100

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

diff --git a/sd/source/ui/inc/tools/SlotStateListener.hxx 
b/sd/source/ui/inc/tools/SlotStateListener.hxx
index 706c61d4998c..54a2e463d30e 100644
--- a/sd/source/ui/inc/tools/SlotStateListener.hxx
+++ b/sd/source/ui/inc/tools/SlotStateListener.hxx
@@ -20,9 +20,9 @@
 #pragma once
 
 #include <com/sun/star/frame/XStatusListener.hpp>
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/compbase.hxx>
 #include <tools/link.hxx>
+#include <cppuhelper/weakref.hxx>
 
 namespace com::sun::star::frame { class XDispatch; }
 namespace com::sun::star::frame { class XDispatchProvider; }
@@ -31,7 +31,7 @@ namespace com::sun::star::frame { struct FeatureStateEvent; }
 
 namespace sd::tools {
 
-typedef cppu::WeakComponentImplHelper<
+typedef comphelper::WeakComponentImplHelper<
     css::frame::XStatusListener
     > SlotStateListenerInterfaceBase;
 
@@ -40,8 +40,7 @@ typedef cppu::WeakComponentImplHelper<
     be used to relay state changes of other slots as well.
 */
 class SlotStateListener final
-    : protected cppu::BaseMutex,
-      public SlotStateListenerInterfaceBase
+    : public SlotStateListenerInterfaceBase
 {
 public:
     /** This convenience version of the constructor takes all parameters
@@ -103,7 +102,7 @@ private:
         reaction to a XComponent::dispose() call.  It releases all currently
         active listeners.
     */
-    virtual void SAL_CALL disposing() override;
+    virtual void disposing(std::unique_lock<std::mutex>&) override;
 
     Link<const OUString&,void> maCallback;
 
diff --git a/sd/source/ui/tools/SlotStateListener.cxx 
b/sd/source/ui/tools/SlotStateListener.cxx
index 529f2a8f6212..9b75b322ee64 100644
--- a/sd/source/ui/tools/SlotStateListener.cxx
+++ b/sd/source/ui/tools/SlotStateListener.cxx
@@ -33,8 +33,7 @@ SlotStateListener::SlotStateListener (
     Link<const OUString&,void> const & rCallback,
     const uno::Reference<frame::XDispatchProvider>& rxDispatchProvider,
     const OUString& rSlotName)
-    : SlotStateListenerInterfaceBase(m_aMutex),
-      mxDispatchProviderWeak(nullptr)
+    : mxDispatchProviderWeak(nullptr)
 {
     SetCallback(rCallback);
     ConnectToDispatchProvider(rxDispatchProvider);
@@ -83,10 +82,10 @@ void SlotStateListener::ObserveSlot (const OUString& 
rSlotName)
     }
 }
 
-void SlotStateListener::disposing()
+void SlotStateListener::disposing(std::unique_lock<std::mutex>&)
 {
     ReleaseListeners();
-    mxDispatchProviderWeak = 
uno::WeakReference<frame::XDispatchProvider>(nullptr);
+    mxDispatchProviderWeak.clear();
     maCallback = Link<const OUString&,void>();
 }
 
@@ -142,7 +141,7 @@ void SAL_CALL SlotStateListener::disposing (
 
 void SlotStateListener::ThrowIfDisposed()
 {
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
+    if (m_bDisposed)
     {
         throw lang::DisposedException ("SlideSorterController object has 
already been disposed",
             static_cast<uno::XWeak*>(this));

Reply via email to