editeng/source/uno/unotext2.cxx |    9 ++++++---
 include/editeng/unotext.hxx     |    8 ++++----
 2 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 97d00de4afe9827ddaf299cfdfa8534425a11fe6
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Dec 18 20:57:01 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Dec 20 18:12:48 2021 +0100

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

diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index 00b123468a5a..275319f3dfe7 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -118,7 +118,6 @@ SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextBase& 
rText, sal_Int32 nPa
 :   SvxUnoTextRangeBase(rText)
 ,   mnParagraph(nPara)
 ,   mrParentText(rText)
-,   maDisposeListeners(maDisposeContainerMutex)
 ,   mbDisposing( false )
 {
     mxParentText = const_cast<SvxUnoTextBase*>(&rText);
@@ -131,7 +130,6 @@ SvxUnoTextContent::SvxUnoTextContent( const 
SvxUnoTextContent& rContent ) noexce
 ,   lang::XTypeProvider()
 ,   cppu::OWeakAggObject()
 ,   mrParentText(rContent.mrParentText)
-,   maDisposeListeners(maDisposeContainerMutex)
 ,   mbDisposing( false )
 {
     mxParentText = rContent.mxParentText;
@@ -232,7 +230,10 @@ void SAL_CALL SvxUnoTextContent::dispose()
 
     lang::EventObject aEvt;
     aEvt.Source = *static_cast<OWeakAggObject*>(this);
-    maDisposeListeners.disposeAndClear(aEvt);
+    {
+        std::unique_lock aMutexGuard(maDisposeContainerMutex);
+        maDisposeListeners.disposeAndClear(aMutexGuard, aEvt);
+    }
 
     if( mxParentText.is() )
         mxParentText->removeTextContent( this );
@@ -240,11 +241,13 @@ void SAL_CALL SvxUnoTextContent::dispose()
 
 void SAL_CALL SvxUnoTextContent::addEventListener( const uno::Reference< 
lang::XEventListener >& xListener )
 {
+    std::unique_lock aGuard(maDisposeContainerMutex);
     maDisposeListeners.addInterface(xListener);
 }
 
 void SAL_CALL SvxUnoTextContent::removeEventListener( const uno::Reference< 
lang::XEventListener >& aListener )
 {
+   std::unique_lock aGuard(maDisposeContainerMutex);
    maDisposeListeners.removeInterface(aListener);
 }
 
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index d87bd38f98cc..87dc02a37c09 100644
--- a/include/editeng/unotext.hxx
+++ b/include/editeng/unotext.hxx
@@ -41,11 +41,11 @@
 #include <com/sun/star/style/LineSpacing.hpp>
 #include <com/sun/star/style/TabStop.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/interfacecontainer4.hxx>
 #include <cppuhelper/implbase1.hxx>
 #include <cppuhelper/weakagg.hxx>
 #include <osl/diagnose.hxx>
-#include <osl/mutex.hxx>
+#include <mutex>
 #include <comphelper/servicehelper.hxx>
 #include <svl/itemset.hxx>
 #include <svl/solar.hrc>
@@ -522,8 +522,8 @@ private:
     const SvxUnoTextBase&   mrParentText;
 
     // for xComponent
-    ::osl::Mutex maDisposeContainerMutex;
-    ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 
maDisposeListeners;
+    std::mutex maDisposeContainerMutex;
+    ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> 
maDisposeListeners;
     bool mbDisposing;
 
 protected:

Reply via email to