sw/source/core/unocore/unobkm.cxx |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 1b3c8f4a6997fdf5685639cc70947c6edb1d85fc
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Dec 21 17:44:35 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Dec 31 19:56:06 2021 +0100

    osl::Mutex->std::mutex in SwXBookmark
    
    Change-Id: Ic3deffdafb62111f20540c1785824e5cd66a1623
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127813
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/unocore/unobkm.cxx 
b/sw/source/core/unocore/unobkm.cxx
index 60d6c47d50b2..347038a09ba0 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -19,7 +19,7 @@
 
 #include <unobookmark.hxx>
 
-#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/interfacecontainer4.hxx>
 #include <comphelper/sequence.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
@@ -44,12 +44,10 @@ using namespace ::com::sun::star;
 class SwXBookmark::Impl
     : public SvtListener
 {
-private:
-    ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
-
 public:
     uno::WeakReference<uno::XInterface> m_wThis;
-    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
m_EventListeners;
+    std::mutex m_Mutex; // just for OInterfaceContainerHelper3
+    ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> 
m_EventListeners;
     SwDoc* m_pDoc;
     ::sw::mark::IMark* m_pRegisteredBookmark;
     OUString m_sMarkName;
@@ -57,8 +55,7 @@ public:
     OUString m_HideCondition;
 
     Impl( SwDoc *const pDoc )
-        : m_EventListeners(m_Mutex)
-        , m_pDoc(pDoc)
+        : m_pDoc(pDoc)
         , m_pRegisteredBookmark(nullptr)
         , m_bHidden(false)
     {
@@ -83,7 +80,8 @@ void SwXBookmark::Impl::Notify(const SfxHint& rHint)
             return;
         }
         lang::EventObject const ev(xThis);
-        m_EventListeners.disposeAndClear(ev);
+        std::unique_lock aGuard(m_Mutex);
+        m_EventListeners.disposeAndClear(aGuard, ev);
     }
 }
 
@@ -302,6 +300,7 @@ void SAL_CALL SwXBookmark::addEventListener(
         const uno::Reference< lang::XEventListener > & xListener)
 {
     // no need to lock here as m_pImpl is const and container threadsafe
+    std::unique_lock aGuard(m_pImpl->m_Mutex);
     m_pImpl->m_EventListeners.addInterface(xListener);
 }
 
@@ -309,6 +308,7 @@ void SAL_CALL SwXBookmark::removeEventListener(
         const uno::Reference< lang::XEventListener > & xListener)
 {
     // no need to lock here as m_pImpl is const and container threadsafe
+    std::unique_lock aGuard(m_pImpl->m_Mutex);
     m_pImpl->m_EventListeners.removeInterface(xListener);
 }
 

Reply via email to