comphelper/Library_comphelper.mk                            |    1 
 comphelper/source/misc/compbase.cxx                         |   48 +++++
 dbaccess/source/ui/inc/unodatbr.hxx                         |    1 
 drawinglayer/source/primitive2d/baseprimitive2d.cxx         |   60 ------
 editeng/source/accessibility/AccessibleEditableTextPara.cxx |    3 
 extensions/source/propctrlr/standardcontrol.hxx             |    1 
 include/comphelper/compbase.hxx                             |  106 ++++++++++++
 include/drawinglayer/primitive2d/baseprimitive2d.hxx        |   40 ----
 include/editeng/AccessibleEditableTextPara.hxx              |    7 
 include/vcl/weldutils.hxx                                   |   42 ++--
 sc/source/ui/view/gridwin.cxx                               |    1 
 sc/source/ui/view/tabcont.cxx                               |    1 
 sw/source/ui/index/cnttab.cxx                               |    1 
 sw/source/uibase/app/docsh2.cxx                             |    1 
 sw/source/uibase/ribbar/inputwin.cxx                        |    1 
 15 files changed, 192 insertions(+), 122 deletions(-)

New commits:
commit 252dd254b5b29298457b889623783152e9bed534
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Wed Dec 22 20:06:20 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Dec 24 08:21:00 2021 +0100

    new comphelper::WeakImplComponentHelper
    
    to replace the cppu:: equivalent with a lightweight version
    that uses std::mutex instead of osl::Mutex
    
    Change-Id: I1b7873a0c2d9cda21f529e43a4ac2fa7574c91a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127335
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk
index 6bd5f0f6492d..20067b14b4ce 100644
--- a/comphelper/Library_comphelper.mk
+++ b/comphelper/Library_comphelper.mk
@@ -91,6 +91,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
     comphelper/source/misc/automationinvokedzone \
     comphelper/source/misc/backupfilehelper \
     comphelper/source/misc/base64 \
+    comphelper/source/misc/compbase \
     comphelper/source/misc/componentbase \
     comphelper/source/misc/configuration \
     comphelper/source/misc/configurationhelper \
diff --git a/comphelper/source/misc/compbase.cxx 
b/comphelper/source/misc/compbase.cxx
new file mode 100644
index 000000000000..bd2ff837943f
--- /dev/null
+++ b/comphelper/source/misc/compbase.cxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <comphelper/compbase.hxx>
+
+namespace comphelper
+{
+WeakComponentImplHelperBase::~WeakComponentImplHelperBase() {}
+
+// css::lang::XComponent
+void SAL_CALL WeakComponentImplHelperBase::dispose()
+{
+    std::unique_lock aGuard(m_aMutex);
+    if (m_bDisposed)
+        return;
+    m_bDisposed = true;
+    disposing();
+    css::lang::EventObject aEvt(static_cast<OWeakObject*>(this));
+    maEventListeners.disposeAndClear(aGuard, aEvt);
+}
+
+void WeakComponentImplHelperBase::disposing() {}
+
+void SAL_CALL WeakComponentImplHelperBase::addEventListener(
+    css::uno::Reference<css::lang::XEventListener> const& rxListener)
+{
+    std::unique_lock aGuard(m_aMutex);
+    if (m_bDisposed)
+        return;
+    maEventListeners.addInterface(rxListener);
+}
+
+void SAL_CALL WeakComponentImplHelperBase::removeEventListener(
+    css::uno::Reference<css::lang::XEventListener> const& rxListener)
+{
+    std::unique_lock aGuard(m_aMutex);
+    maEventListeners.removeInterface(rxListener);
+}
+
+} // namespace comphelper
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx 
b/dbaccess/source/ui/inc/unodatbr.hxx
index 07240e843378..efe4ae51b27c 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/sdb/application/DatabaseObject.hpp>
 #include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
 #include <com/sun/star/sdb/XDatabaseRegistrationsListener.hpp>
+#include <comphelper/interfacecontainer2.hxx>
 #include <cppuhelper/implbase5.hxx>
 #include "callbacks.hxx"
 #include <vcl/transfer.hxx>
diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx 
b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index b5590bce082c..29f4dc7fd473 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -29,66 +29,6 @@
 
 using namespace css;
 
-BasePrimitive2DImplBase::~BasePrimitive2DImplBase() {}
-
-css::uno::Any BasePrimitive2DImplBase::queryInterface(css::uno::Type const& 
rType)
-{
-    css::uno::Any aReturn = ::cppu::queryInterface(
-        rType, static_cast<uno::XWeak*>(this), 
static_cast<lang::XComponent*>(this),
-        static_cast<lang::XTypeProvider*>(this), 
static_cast<graphic::XPrimitive2D*>(this),
-        static_cast<util::XAccounting*>(this));
-    if (aReturn.hasValue())
-        return aReturn;
-    return OWeakObject::queryInterface(rType);
-}
-
-void BasePrimitive2DImplBase::acquire() noexcept { OWeakObject::acquire(); }
-
-void BasePrimitive2DImplBase::release() noexcept
-{
-    if (osl_atomic_decrement(&m_refCount) != 0)
-        return;
-
-    // ensure no other references are created, via the weak connection point, 
from now on
-    disposeWeakConnectionPoint();
-    // restore reference count:
-    osl_atomic_increment(&m_refCount);
-    //    if (! rBHelper.bDisposed) {
-    //        try {
-    //            dispose();
-    //        }
-    //        catch (RuntimeException const& exc) { // don't break throw ()
-    //            SAL_WARN( "cppuhelper", exc );
-    //        }
-    //        OSL_ASSERT( rBHelper.bDisposed );
-    //    }
-    OWeakObject::release();
-}
-
-void BasePrimitive2DImplBase::dispose() {}
-
-void BasePrimitive2DImplBase::addEventListener(
-    css::uno::Reference<css::lang::XEventListener> const&)
-{
-    assert(false);
-}
-void BasePrimitive2DImplBase::removeEventListener(
-    css::uno::Reference<css::lang::XEventListener> const&)
-{
-    assert(false);
-}
-
-css::uno::Sequence<css::uno::Type> BasePrimitive2DImplBase::getTypes()
-{
-    static const css::uno::Sequence<uno::Type> aTypeList{
-        cppu::UnoType<uno::XWeak>::get(), 
cppu::UnoType<lang::XComponent>::get(),
-        cppu::UnoType<lang::XTypeProvider>::get(), 
cppu::UnoType<graphic::XPrimitive2D>::get(),
-        cppu::UnoType<util::XAccounting>::get()
-    };
-
-    return aTypeList;
-}
-
 namespace drawinglayer::primitive2d
 {
 BasePrimitive2D::BasePrimitive2D() {}
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx 
b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index e547767911e2..d074ddfd5a11 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -104,8 +104,7 @@ namespace accessibility
     AccessibleEditableTextPara::AccessibleEditableTextPara(
                                 const uno::Reference< XAccessible >& rParent,
                                 const AccessibleParaManager* _pParaManager )
-        : AccessibleTextParaInterfaceBase( m_aMutex ),
-          mnParagraphIndex( 0 ),
+        : mnParagraphIndex( 0 ),
           mnIndexInParent( 0 ),
           mpEditSource( nullptr ),
           maEEOffset( 0, 0 ),
diff --git a/extensions/source/propctrlr/standardcontrol.hxx 
b/extensions/source/propctrlr/standardcontrol.hxx
index a54af78c3a3a..7a0c585b775c 100644
--- a/extensions/source/propctrlr/standardcontrol.hxx
+++ b/extensions/source/propctrlr/standardcontrol.hxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/inspection/XStringListControl.hpp>
 #include <com/sun/star/inspection/XHyperlinkControl.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
+#include <comphelper/interfacecontainer2.hxx>
 #include <svtools/ctrlbox.hxx>
 #include <svx/colorbox.hxx>
 
diff --git a/include/comphelper/compbase.hxx b/include/comphelper/compbase.hxx
new file mode 100644
index 000000000000..6143fbb411ac
--- /dev/null
+++ b/include/comphelper/compbase.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <comphelper/comphelperdllapi.h>
+#include <comphelper/interfacecontainer4.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/queryinterface.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <mutex>
+
+namespace comphelper
+{
+/**
+    Serves two purposes
+    (1) extracts code that doesn't need to be templated
+    (2) helps to handle the custom where we have conflicting interfaces
+        e.g. multiple UNO interfaces that extend css::lang::XComponent
+*/
+class COMPHELPER_DLLPUBLIC WeakComponentImplHelperBase : public 
cppu::OWeakObject,
+                                                         public 
css::lang::XComponent
+{
+public:
+    virtual ~WeakComponentImplHelperBase() override;
+
+    // css::lang::XComponent
+    virtual void SAL_CALL dispose() override;
+    virtual void SAL_CALL
+    addEventListener(css::uno::Reference<css::lang::XEventListener> const& 
rxListener) override;
+    virtual void SAL_CALL
+    removeEventListener(css::uno::Reference<css::lang::XEventListener> const& 
rxListener) override;
+
+    /** called by dispose for subclasses to do dispose() work */
+    virtual void disposing();
+
+protected:
+    comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> 
maEventListeners;
+    mutable std::mutex m_aMutex;
+    bool m_bDisposed;
+};
+
+template <typename... Ifc>
+class SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper : public 
WeakComponentImplHelperBase,
+                                                       public 
css::lang::XTypeProvider,
+                                                       public Ifc...
+{
+public:
+    virtual void SAL_CALL acquire() noexcept final override { 
OWeakObject::acquire(); }
+
+    virtual void SAL_CALL release() noexcept final override { 
OWeakObject::release(); }
+
+    // css::lang::XComponent
+    virtual void SAL_CALL dispose() noexcept final override
+    {
+        WeakComponentImplHelperBase::dispose();
+    }
+    virtual void SAL_CALL addEventListener(
+        css::uno::Reference<css::lang::XEventListener> const& rxListener) 
final override
+    {
+        WeakComponentImplHelperBase::addEventListener(rxListener);
+    }
+    virtual void SAL_CALL removeEventListener(
+        css::uno::Reference<css::lang::XEventListener> const& rxListener) 
final override
+    {
+        WeakComponentImplHelperBase::removeEventListener(rxListener);
+    }
+
+    virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const& rType) 
override
+    {
+        css::uno::Any aReturn = ::cppu::queryInterface(
+            rType, static_cast<css::uno::XWeak*>(this),
+            
static_cast<css::lang::XComponent*>(static_cast<WeakComponentImplHelperBase*>(this)),
+            static_cast<css::lang::XTypeProvider*>(this), 
static_cast<Ifc*>(this)...);
+        if (aReturn.hasValue())
+            return aReturn;
+        return OWeakObject::queryInterface(rType);
+    }
+
+    // css::lang::XTypeProvider
+    virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override
+    {
+        static const css::uno::Sequence<css::uno::Type> aTypeList{
+            cppu::UnoType<css::uno::XWeak>::get(), 
cppu::UnoType<css::lang::XComponent>::get(),
+            cppu::UnoType<css::lang::XTypeProvider>::get(), 
cppu::UnoType<Ifc>::get()...
+        };
+        return aTypeList;
+    }
+    virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() 
override
+    {
+        return css::uno::Sequence<sal_Int8>();
+    }
+};
+
+} //  namespace comphelper
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx 
b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
index 5fbcafc655db..c264912941aa 100644
--- a/include/drawinglayer/primitive2d/baseprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
@@ -25,55 +25,21 @@
 #include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
 #include <drawinglayer/geometry/viewinformation2d.hxx>
 
-#include <cppuhelper/weak.hxx>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
 #include <com/sun/star/util/XAccounting.hpp>
 #include <basegfx/range/b2drange.hxx>
 #include <com/sun/star/graphic/XPrimitive2D.hpp>
+#include <comphelper/compbase.hxx>
 #include <salhelper/simplereferenceobject.hxx>
 #include <rtl/ref.hxx>
 #include <deque>
-#include <mutex>
 
 namespace drawinglayer::geometry
 {
 class ViewInformation2D;
 }
 
-/** This is a custom re-implementation of cppu::WeakComponentImplHelper which 
uses
-   std::mutex and skips parts of the XComponent stuff.
-*/
-class DRAWINGLAYERCORE_DLLPUBLIC BasePrimitive2DImplBase : public 
cppu::OWeakObject,
-                                                           public 
css::lang::XComponent,
-                                                           public 
css::lang::XTypeProvider,
-                                                           public 
css::graphic::XPrimitive2D,
-                                                           public 
css::util::XAccounting
-{
-public:
-    virtual ~BasePrimitive2DImplBase() override;
-
-    virtual void SAL_CALL acquire() noexcept override;
-    virtual void SAL_CALL release() noexcept override;
-    virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const& aType) 
override;
-
-    // css::lang::XComponent
-    virtual void SAL_CALL dispose() override;
-    virtual void SAL_CALL
-    addEventListener(css::uno::Reference<css::lang::XEventListener> const& 
xListener) override;
-    virtual void SAL_CALL
-    removeEventListener(css::uno::Reference<css::lang::XEventListener> const& 
xListener) override;
-
-    // css::lang::XTypeProvider
-    virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
-    virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() 
override
-    {
-        return css::uno::Sequence<sal_Int8>();
-    }
-
-protected:
-    mutable std::mutex m_aMutex;
-};
+typedef comphelper::WeakComponentImplHelper<css::graphic::XPrimitive2D, 
css::util::XAccounting>
+    BasePrimitive2DImplBase;
 
 namespace drawinglayer::primitive2d
 {
diff --git a/include/editeng/AccessibleEditableTextPara.hxx 
b/include/editeng/AccessibleEditableTextPara.hxx
index 34fab512fbcb..02f907704bdb 100644
--- a/include/editeng/AccessibleEditableTextPara.hxx
+++ b/include/editeng/AccessibleEditableTextPara.hxx
@@ -23,8 +23,7 @@
 #include <config_options.h>
 #include <rtl/ustring.hxx>
 #include <tools/gen.hxx>
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
+#include <comphelper/compbase.hxx>
 
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/lang/XServiceInfo.hpp>
@@ -51,7 +50,7 @@ namespace accessibility { class AccessibleImageBullet; }
 
 namespace accessibility
 {
-    typedef ::cppu::WeakComponentImplHelper< css::accessibility::XAccessible,
+    typedef ::comphelper::WeakComponentImplHelper< 
css::accessibility::XAccessible,
                                      css::accessibility::XAccessibleContext,
                                      css::accessibility::XAccessibleComponent,
                                      
css::accessibility::XAccessibleEditableText,
@@ -63,7 +62,7 @@ namespace accessibility
 
     /** This class implements the actual text paragraphs for the 
EditEngine/Outliner UAA
      */
-    class UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) AccessibleEditableTextPara final 
: public ::cppu::BaseMutex, public AccessibleTextParaInterfaceBase, private 
::comphelper::OCommonAccessibleText
+    class UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) AccessibleEditableTextPara final 
: public AccessibleTextParaInterfaceBase, private 
::comphelper::OCommonAccessibleText
     {
 
         // override OCommonAccessibleText methods
diff --git a/include/vcl/weldutils.hxx b/include/vcl/weldutils.hxx
index a11ab6c9f283..a8c2e1eac11d 100644
--- a/include/vcl/weldutils.hxx
+++ b/include/vcl/weldutils.hxx
@@ -15,9 +15,8 @@
 #include <com/sun/star/frame/XFrame.hpp>
 #include <com/sun/star/frame/XStatusListener.hpp>
 #include <com/sun/star/uno/Reference.hxx>
-#include <comphelper/interfacecontainer2.hxx>
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/interfacecontainer4.hxx>
+#include <comphelper/compbase.hxx>
 #include <tools/time.hxx>
 #include <vcl/dllapi.h>
 #include <vcl/formatter.hxx>
@@ -34,32 +33,25 @@ class Window;
 
 namespace weld
 {
-typedef cppu::WeakComponentImplHelper<css::awt::XWindow> 
TransportAsXWindow_Base;
+typedef comphelper::WeakComponentImplHelper<css::awt::XWindow> 
TransportAsXWindow_Base;
 
-class VCL_DLLPUBLIC TransportAsXWindow : public cppu::BaseMutex, public 
TransportAsXWindow_Base
+class VCL_DLLPUBLIC TransportAsXWindow : public TransportAsXWindow_Base
 {
 private:
     weld::Widget* m_pWeldWidget;
     weld::Builder* m_pWeldWidgetBuilder;
 
-    comphelper::OInterfaceContainerHelper2 m_aWindowListeners;
-    comphelper::OInterfaceContainerHelper2 m_aKeyListeners;
-    comphelper::OInterfaceContainerHelper2 m_aFocusListeners;
-    comphelper::OInterfaceContainerHelper2 m_aMouseListeners;
-    comphelper::OInterfaceContainerHelper2 m_aMotionListeners;
-    comphelper::OInterfaceContainerHelper2 m_aPaintListeners;
+    comphelper::OInterfaceContainerHelper4<css::awt::XWindowListener> 
m_aWindowListeners;
+    comphelper::OInterfaceContainerHelper4<css::awt::XKeyListener> 
m_aKeyListeners;
+    comphelper::OInterfaceContainerHelper4<css::awt::XFocusListener> 
m_aFocusListeners;
+    comphelper::OInterfaceContainerHelper4<css::awt::XMouseListener> 
m_aMouseListeners;
+    comphelper::OInterfaceContainerHelper4<css::awt::XMouseMotionListener> 
m_aMotionListeners;
+    comphelper::OInterfaceContainerHelper4<css::awt::XPaintListener> 
m_aPaintListeners;
 
 public:
     TransportAsXWindow(weld::Widget* pWeldWidget, weld::Builder* 
pWeldWidgetBuilder = nullptr)
-        : TransportAsXWindow_Base(m_aMutex)
-        , m_pWeldWidget(pWeldWidget)
+        : m_pWeldWidget(pWeldWidget)
         , m_pWeldWidgetBuilder(pWeldWidgetBuilder)
-        , m_aWindowListeners(m_aMutex)
-        , m_aKeyListeners(m_aMutex)
-        , m_aFocusListeners(m_aMutex)
-        , m_aMouseListeners(m_aMutex)
-        , m_aMotionListeners(m_aMutex)
-        , m_aPaintListeners(m_aMutex)
     {
     }
 
@@ -96,72 +88,84 @@ public:
     void SAL_CALL
     addWindowListener(const css::uno::Reference<css::awt::XWindowListener>& 
rListener) override
     {
+        std::unique_lock g(m_aMutex);
         m_aWindowListeners.addInterface(rListener);
     }
 
     void SAL_CALL
     removeWindowListener(const css::uno::Reference<css::awt::XWindowListener>& 
rListener) override
     {
+        std::unique_lock g(m_aMutex);
         m_aWindowListeners.removeInterface(rListener);
     }
 
     void SAL_CALL
     addFocusListener(const css::uno::Reference<css::awt::XFocusListener>& 
rListener) override
     {
+        std::unique_lock g(m_aMutex);
         m_aFocusListeners.addInterface(rListener);
     }
 
     void SAL_CALL
     removeFocusListener(const css::uno::Reference<css::awt::XFocusListener>& 
rListener) override
     {
+        std::unique_lock g(m_aMutex);
         m_aFocusListeners.removeInterface(rListener);
     }
 
     void SAL_CALL
     addKeyListener(const css::uno::Reference<css::awt::XKeyListener>& 
rListener) override
     {
+        std::unique_lock g(m_aMutex);
         m_aKeyListeners.addInterface(rListener);
     }
 
     void SAL_CALL
     removeKeyListener(const css::uno::Reference<css::awt::XKeyListener>& 
rListener) override
     {
+        std::unique_lock g(m_aMutex);
         m_aKeyListeners.removeInterface(rListener);
     }
 
     void SAL_CALL
     addMouseListener(const css::uno::Reference<css::awt::XMouseListener>& 
rListener) override
     {
+        std::unique_lock g(m_aMutex);
         m_aMouseListeners.addInterface(rListener);
     }
 
     void SAL_CALL
     removeMouseListener(const css::uno::Reference<css::awt::XMouseListener>& 
rListener) override
     {
+        std::unique_lock g(m_aMutex);
         m_aMouseListeners.removeInterface(rListener);
     }
 
     void SAL_CALL addMouseMotionListener(
         const css::uno::Reference<css::awt::XMouseMotionListener>& rListener) 
override
     {
+        std::unique_lock g(m_aMutex);
         m_aMotionListeners.addInterface(rListener);
     }
 
     void SAL_CALL removeMouseMotionListener(
         const css::uno::Reference<css::awt::XMouseMotionListener>& rListener) 
override
     {
+        std::unique_lock g(m_aMutex);
         m_aMotionListeners.removeInterface(rListener);
     }
 
     void SAL_CALL
     addPaintListener(const css::uno::Reference<css::awt::XPaintListener>& 
rListener) override
     {
+        std::unique_lock g(m_aMutex);
         m_aPaintListeners.addInterface(rListener);
     }
 
     void SAL_CALL
     removePaintListener(const css::uno::Reference<css::awt::XPaintListener>& 
rListener) override
     {
+        std::unique_lock g(m_aMutex);
         m_aPaintListeners.removeInterface(rListener);
     }
 };
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index e2f3a1e81e2b..b03c094de0c3 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -22,6 +22,7 @@
 #include <cstdlib>
 #include <memory>
 #include <editeng/adjustitem.hxx>
+#include <osl/diagnose.h>
 #include <sal/log.hxx>
 #include <sot/storage.hxx>
 #include <editeng/eeitem.hxx>
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 31628bc9c342..f4ad32ba8ac5 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <osl/diagnose.h>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/docfile.hxx>
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 17a360bf522c..e2a334ebda26 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -19,6 +19,7 @@
 
 #include <sal/config.h>
 
+#include <osl/diagnose.h>
 #include <o3tl/safeint.hxx>
 #include <sal/log.hxx>
 #include <svl/style.hxx>
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 063b74e7da4a..415c30d4d296 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -19,6 +19,7 @@
 
 #include <config_features.h>
 
+#include <osl/diagnose.h>
 #include <com/sun/star/drawing/ModuleDispatcher.hpp>
 #include <com/sun/star/frame/DispatchHelper.hpp>
 #include <ooo/vba/word/XDocument.hpp>
diff --git a/sw/source/uibase/ribbar/inputwin.cxx 
b/sw/source/uibase/ribbar/inputwin.cxx
index 26325060cb10..a472fc3f227c 100644
--- a/sw/source/uibase/ribbar/inputwin.cxx
+++ b/sw/source/uibase/ribbar/inputwin.cxx
@@ -20,6 +20,7 @@
 #include <sal/config.h>
 #include <sal/log.hxx>
 
+#include <osl/diagnose.h>
 #include <comphelper/string.hxx>
 #include <o3tl/safeint.hxx>
 #include <officecfg/Office/Common.hxx>

Reply via email to