framework/inc/uielement/menubarmanager.hxx                  |    9 +++---
 framework/source/services/ContextChangeEventMultiplexer.cxx |   16 ++++++------
 framework/source/uielement/menubarmanager.cxx               |   15 +++++------
 3 files changed, 19 insertions(+), 21 deletions(-)

New commits:
commit d4257daba1155ebccbfebea99bad0e4152ca9b08
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Dec 24 20:58:28 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Dec 25 19:34:05 2021 +0100

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

diff --git a/framework/inc/uielement/menubarmanager.hxx 
b/framework/inc/uielement/menubarmanager.hxx
index a77552a67213..079d127d4d83 100644
--- a/framework/inc/uielement/menubarmanager.hxx
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -41,8 +41,8 @@
 #include <rtl/ustring.hxx>
 #include <vcl/menu.hxx>
 #include <vcl/timer.hxx>
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/compbase.hxx>
+#include <cppuhelper/weakref.hxx>
 #include <framework/addonsoptions.hxx>
 
 namespace framework
@@ -56,8 +56,7 @@ struct PopupControllerEntry
 typedef std::unordered_map< OUString, PopupControllerEntry > 
PopupControllerCache;
 
 class MenuBarManager final :
-    protected cppu::BaseMutex,
-    public cppu::WeakComponentImplHelper<
+    public comphelper::WeakComponentImplHelper<
         css::frame::XStatusListener,
         css::frame::XFrameActionListener,
         css::ui::XUIConfigurationListener,
@@ -121,7 +120,7 @@ class MenuBarManager final :
         DECL_LINK( Deactivate, Menu *, bool );
         DECL_LINK( AsyncSettingsHdl, Timer *, void );
 
-        void SAL_CALL disposing() override;
+        void disposing(std::unique_lock<std::mutex>&) override;
         void RemoveListener();
         void RequestImages();
         void RetrieveImageManagers();
diff --git a/framework/source/uielement/menubarmanager.cxx 
b/framework/source/uielement/menubarmanager.cxx
index 08998a4b8fe8..7b856a01d43d 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -87,8 +87,7 @@ MenuBarManager::MenuBarManager(
     const Reference< XDispatchProvider >& rDispatchProvider,
     const OUString& rModuleIdentifier,
     Menu* pMenu, bool bDelete, bool bHasMenuBar ):
-    WeakComponentImplHelper( m_aMutex )
-    , m_bRetrieveImages( false )
+      m_bRetrieveImages( false )
     , m_bAcceleratorCfg( false )
     , m_bHasMenuBar( bHasMenuBar )
     , m_xContext(rxContext)
@@ -104,7 +103,7 @@ Any SAL_CALL MenuBarManager::getMenuHandle( const Sequence< 
sal_Int8 >& /*Proces
 {
     SolarMutexGuard aSolarGuard;
 
-    if ( rBHelper.bDisposed || rBHelper.bInDispose )
+    if ( m_bDisposed )
         throw css::lang::DisposedException();
 
     Any a;
@@ -141,7 +140,7 @@ void MenuBarManager::Destroy()
 {
     SolarMutexGuard aGuard;
 
-    if ( rBHelper.bDisposed )
+    if ( m_bDisposed )
         return;
 
     // stop asynchronous settings timer and
@@ -159,7 +158,7 @@ void MenuBarManager::Destroy()
 }
 
 // XComponent
-void SAL_CALL MenuBarManager::disposing()
+void MenuBarManager::disposing(std::unique_lock<std::mutex>& )
 {
     Reference< XComponent > xThis( this );
 
@@ -202,7 +201,7 @@ void SAL_CALL MenuBarManager::elementInserted( const 
css::ui::ConfigurationEvent
     SolarMutexGuard g;
 
     /* SAFE AREA 
-----------------------------------------------------------------------------------------------
 */
-    if ( rBHelper.bDisposed || rBHelper.bInDispose )
+    if ( m_bDisposed )
         return;
 
     sal_Int16 nImageType = sal_Int16();
@@ -225,7 +224,7 @@ void SAL_CALL MenuBarManager::frameAction( const 
FrameActionEvent& Action )
 {
     SolarMutexGuard g;
 
-    if ( rBHelper.bDisposed || rBHelper.bInDispose )
+    if ( m_bDisposed )
         throw css::lang::DisposedException();
 
     if ( Action.Action != FrameAction_CONTEXT_CHANGED )
@@ -253,7 +252,7 @@ void SAL_CALL MenuBarManager::statusChanged( const 
FeatureStateEvent& Event )
 
     SolarMutexGuard aSolarGuard;
     {
-        if ( rBHelper.bDisposed || rBHelper.bInDispose )
+        if ( m_bDisposed )
             return;
 
         // We have to check all menu entries as there can be identical entries 
in a popup menu.
commit 98dbe250d7d5e3ebe626e8c8650e7fdccd399869
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Dec 24 21:01:56 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Dec 25 19:33:53 2021 +0100

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

diff --git a/framework/source/services/ContextChangeEventMultiplexer.cxx 
b/framework/source/services/ContextChangeEventMultiplexer.cxx
index 0dea0823c52b..76424b3aea03 100644
--- a/framework/source/services/ContextChangeEventMultiplexer.cxx
+++ b/framework/source/services/ContextChangeEventMultiplexer.cxx
@@ -26,10 +26,10 @@
 #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/compbase.hxx>
 #include <cppuhelper/supportsservice.hxx>
-#include <cppuhelper/basemutex.hxx>
 #include <rtl/ref.hxx>
+#include <osl/diagnose.h>
 
 #include <algorithm>
 #include <map>
@@ -40,22 +40,21 @@ using namespace css::uno;
 
 namespace {
 
-typedef ::cppu::WeakComponentImplHelper <
+typedef comphelper::WeakComponentImplHelper <
     css::ui::XContextChangeEventMultiplexer,
     css::lang::XServiceInfo,
     css::lang::XEventListener
     > ContextChangeEventMultiplexerInterfaceBase;
 
 class ContextChangeEventMultiplexer
-    : private ::cppu::BaseMutex,
-      public ContextChangeEventMultiplexerInterfaceBase
+    : public ContextChangeEventMultiplexerInterfaceBase
 {
 public:
     ContextChangeEventMultiplexer();
     ContextChangeEventMultiplexer(const ContextChangeEventMultiplexer&) = 
delete;
     ContextChangeEventMultiplexer& operator=(const 
ContextChangeEventMultiplexer&) = delete;
 
-    virtual void SAL_CALL disposing() override;
+    virtual void disposing(std::unique_lock<std::mutex>&) override;
 
     // XContextChangeEventMultiplexer
     virtual void SAL_CALL addContextChangeEventListener (
@@ -106,15 +105,16 @@ public:
 };
 
 ContextChangeEventMultiplexer::ContextChangeEventMultiplexer()
-    : ContextChangeEventMultiplexerInterfaceBase(m_aMutex)
 {
 }
 
-void SAL_CALL ContextChangeEventMultiplexer::disposing()
+void ContextChangeEventMultiplexer::disposing(std::unique_lock<std::mutex>& 
rGuard)
 {
     ListenerMap aListeners;
     aListeners.swap(maListeners);
 
+    rGuard.unlock();
+
     css::uno::Reference<css::uno::XInterface> xThis 
(static_cast<XWeak*>(this));
     css::lang::EventObject aEvent (xThis);
     for (auto const& container : aListeners)

Reply via email to