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>
This commit is contained in:
Noel Grandin 2021-12-18 20:57:01 +02:00 committed by Noel Grandin
parent 1dc917b86c
commit 97d00de4af
2 changed files with 10 additions and 7 deletions

View file

@ -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);
}

View file

@ -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: