sd/source/ui/framework/configuration/Configuration.cxx |   21 +++++++----------
 sd/source/ui/framework/module/ModuleController.cxx     |    6 ++--
 sd/source/ui/inc/framework/Configuration.hxx           |   12 ++++-----
 sd/source/ui/inc/framework/ModuleController.hxx        |   12 ++++-----
 4 files changed, 22 insertions(+), 29 deletions(-)

New commits:
commit 820ac2f6a932855ecd79f6050ab4a9064237d89c
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Dec 28 17:12:27 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Dec 29 07:14:40 2021 +0100

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

diff --git a/sd/source/ui/framework/module/ModuleController.cxx 
b/sd/source/ui/framework/module/ModuleController.cxx
index 7da417795aeb..855a4bdd3efe 100644
--- a/sd/source/ui/framework/module/ModuleController.cxx
+++ b/sd/source/ui/framework/module/ModuleController.cxx
@@ -24,6 +24,7 @@
 
 #include <tools/ConfigurationAccess.hxx>
 #include <comphelper/processfactory.hxx>
+#include <cppuhelper/weakref.hxx>
 #include <unordered_map>
 
 #include <tools/diagnose_ex.h>
@@ -65,8 +66,7 @@ Reference<XModuleController> ModuleController::CreateInstance 
(
 }
 
 ModuleController::ModuleController (const Reference<XComponentContext>& 
rxContext)
-    : ModuleControllerInterfaceBase(m_aMutex),
-      mpResourceToFactoryMap(new ResourceToFactoryMap()),
+    : mpResourceToFactoryMap(new ResourceToFactoryMap()),
       mpLoadedFactories(new LoadedFactoryContainer())
 {
     /** Load a list of URL to service mappings from the
@@ -103,7 +103,7 @@ ModuleController::~ModuleController() noexcept
 {
 }
 
-void SAL_CALL ModuleController::disposing()
+void ModuleController::disposing(std::unique_lock<std::mutex>&)
 {
     // Break the cyclic reference back to DrawController object
     mpLoadedFactories.reset();
diff --git a/sd/source/ui/inc/framework/ModuleController.hxx 
b/sd/source/ui/inc/framework/ModuleController.hxx
index 000dddd37b88..fb9e4bc2d92d 100644
--- a/sd/source/ui/inc/framework/ModuleController.hxx
+++ b/sd/source/ui/inc/framework/ModuleController.hxx
@@ -21,8 +21,7 @@
 
 #include <com/sun/star/drawing/framework/XModuleController.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/compbase.hxx>
 
 #include <memory>
 
@@ -31,7 +30,7 @@ namespace com::sun::star::uno { class XComponentContext; }
 
 namespace sd::framework {
 
-typedef ::cppu::WeakComponentImplHelper <
+typedef comphelper::WeakComponentImplHelper <
     css::drawing::framework::XModuleController,
     css::lang::XInitialization
     > ModuleControllerInterfaceBase;
@@ -54,9 +53,8 @@ typedef ::cppu::WeakComponentImplHelper <
     can then register as listeners at the ConfigurationController or do
     whatever they like.
 */
-class ModuleController
-    : private cppu::BaseMutex,
-      public ModuleControllerInterfaceBase
+class ModuleController final
+    : public ModuleControllerInterfaceBase
 {
 public:
     static css::uno::Reference<
@@ -65,7 +63,7 @@ public:
             const css::uno::Reference<css::uno::XComponentContext>&
             rxContext);
 
-    virtual void SAL_CALL disposing() override;
+    virtual void disposing(std::unique_lock<std::mutex>&) override;
 
     // XModuleController
 
commit 388369ad8fad3684da03d23c850e9f4e1b7bec1d
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Dec 28 17:23:22 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Dec 29 07:14:25 2021 +0100

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

diff --git a/sd/source/ui/framework/configuration/Configuration.cxx 
b/sd/source/ui/framework/configuration/Configuration.cxx
index 415339586613..7b813a42bddb 100644
--- a/sd/source/ui/framework/configuration/Configuration.cxx
+++ b/sd/source/ui/framework/configuration/Configuration.cxx
@@ -62,8 +62,7 @@ public:
 Configuration::Configuration (
     const Reference<XConfigurationControllerBroadcaster>& rxBroadcaster,
     bool bBroadcastRequestEvents)
-    : ConfigurationInterfaceBase(m_aMutex),
-      mpResourceContainer(new ResourceContainer()),
+    : mpResourceContainer(new ResourceContainer()),
       mxBroadcaster(rxBroadcaster),
       mbBroadcastRequestEvents(bBroadcastRequestEvents)
 {
@@ -73,8 +72,7 @@ Configuration::Configuration (
     const Reference<XConfigurationControllerBroadcaster>& rxBroadcaster,
     bool bBroadcastRequestEvents,
     const ResourceContainer& rResourceContainer)
-    : ConfigurationInterfaceBase(m_aMutex),
-      mpResourceContainer(new ResourceContainer(rResourceContainer)),
+    : mpResourceContainer(new ResourceContainer(rResourceContainer)),
       mxBroadcaster(rxBroadcaster),
       mbBroadcastRequestEvents(bBroadcastRequestEvents)
 {
@@ -84,9 +82,8 @@ Configuration::~Configuration()
 {
 }
 
-void SAL_CALL Configuration::disposing()
+void Configuration::disposing(std::unique_lock<std::mutex>&)
 {
-    ::osl::MutexGuard aGuard (m_aMutex);
     mpResourceContainer->clear();
     mxBroadcaster = nullptr;
 }
@@ -130,7 +127,7 @@ Sequence<Reference<XResourceId> > SAL_CALL 
Configuration::getResources (
     const OUString& rsResourceURLPrefix,
     AnchorBindingMode eMode)
 {
-    ::osl::MutexGuard aGuard (m_aMutex);
+    std::unique_lock aGuard (m_aMutex);
     ThrowIfDisposed();
 
     const bool bFilterResources (!rsResourceURLPrefix.isEmpty());
@@ -168,7 +165,7 @@ Sequence<Reference<XResourceId> > SAL_CALL 
Configuration::getResources (
 
 sal_Bool SAL_CALL Configuration::hasResource (const Reference<XResourceId>& 
rxResourceId)
 {
-    ::osl::MutexGuard aGuard (m_aMutex);
+    std::unique_lock aGuard (m_aMutex);
     ThrowIfDisposed();
 
     return rxResourceId.is()
@@ -179,7 +176,7 @@ sal_Bool SAL_CALL Configuration::hasResource (const 
Reference<XResourceId>& rxRe
 
 Reference<util::XCloneable> SAL_CALL Configuration::createClone()
 {
-    ::osl::MutexGuard aGuard (m_aMutex);
+    std::unique_lock aGuard (m_aMutex);
     ThrowIfDisposed();
 
     return new Configuration(
@@ -192,10 +189,10 @@ Reference<util::XCloneable> SAL_CALL 
Configuration::createClone()
 
 OUString SAL_CALL Configuration::getName()
 {
-    ::osl::MutexGuard aGuard (m_aMutex);
+    std::unique_lock aGuard (m_aMutex);
     OUStringBuffer aString;
 
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
+    if (m_bDisposed)
         aString.append("DISPOSED ");
     aString.append("Configuration[");
 
@@ -263,7 +260,7 @@ void Configuration::PostEvent (
 
 void Configuration::ThrowIfDisposed() const
 {
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
+    if (m_bDisposed)
     {
         throw lang::DisposedException ("Configuration object has already been 
disposed",
             const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
diff --git a/sd/source/ui/inc/framework/Configuration.hxx 
b/sd/source/ui/inc/framework/Configuration.hxx
index 11c4093efd76..8f33ef4311be 100644
--- a/sd/source/ui/inc/framework/Configuration.hxx
+++ b/sd/source/ui/inc/framework/Configuration.hxx
@@ -22,8 +22,7 @@
 #include <com/sun/star/drawing/framework/XConfiguration.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/container/XNamed.hpp>
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/compbase.hxx>
 
 #include <memory>
 
@@ -32,7 +31,7 @@ namespace com::sun::star::drawing::framework { class 
XConfigurationControllerBro
 
 namespace sd::framework {
 
-typedef ::cppu::WeakComponentImplHelper <
+typedef comphelper::WeakComponentImplHelper <
     css::drawing::framework::XConfiguration,
     css::container::XNamed,
     css::lang::XServiceInfo
@@ -57,9 +56,8 @@ typedef ::cppu::WeakComponentImplHelper <
     exception of the configuration controller and objects that implement the
     XConfigurationChangeOperation interface.
 */
-class Configuration
-    : private cppu::BaseMutex,
-      public ConfigurationInterfaceBase
+class Configuration final
+    : public ConfigurationInterfaceBase
 {
 public:
     /** Create a new configuration with a broadcaster that is used to send
@@ -78,7 +76,7 @@ public:
         bool bBroadcastRequestEvents);
     virtual ~Configuration() override;
 
-    virtual void SAL_CALL disposing() override;
+    virtual void disposing(std::unique_lock<std::mutex>&) override;
 
     // XConfiguration
 

Reply via email to