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.grandin@collabora.co.uk>
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index 00b1234..275319f 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 d87bd38..87dc02a 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: