osl::Mutex->std::mutex in SwXParagraph
Change-Id: If65a862dab3d760357598ece1940e68e4bbc7907 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127803 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
68647c78ea
commit
aa29327fca
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <unoparagraph.hxx>
|
#include <unoparagraph.hxx>
|
||||||
|
|
||||||
#include <comphelper/interfacecontainer3.hxx>
|
#include <comphelper/interfacecontainer4.hxx>
|
||||||
#include <cppuhelper/exc_hlp.hxx>
|
#include <cppuhelper/exc_hlp.hxx>
|
||||||
#include <cppuhelper/supportsservice.hxx>
|
#include <cppuhelper/supportsservice.hxx>
|
||||||
#include <osl/diagnose.h>
|
#include <osl/diagnose.h>
|
||||||
@@ -112,13 +112,11 @@ static beans::PropertyState lcl_SwXParagraph_getPropertyState(
|
|||||||
class SwXParagraph::Impl
|
class SwXParagraph::Impl
|
||||||
: public SvtListener
|
: public SvtListener
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SwXParagraph& m_rThis;
|
SwXParagraph& m_rThis;
|
||||||
uno::WeakReference<uno::XInterface> m_wThis;
|
uno::WeakReference<uno::XInterface> m_wThis;
|
||||||
::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> m_EventListeners;
|
std::mutex m_Mutex; // just for OInterfaceContainerHelper4
|
||||||
|
::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_EventListeners;
|
||||||
SfxItemPropertySet const& m_rPropSet;
|
SfxItemPropertySet const& m_rPropSet;
|
||||||
bool m_bIsDescriptor;
|
bool m_bIsDescriptor;
|
||||||
sal_Int32 m_nSelectionStartPos;
|
sal_Int32 m_nSelectionStartPos;
|
||||||
@@ -131,7 +129,6 @@ public:
|
|||||||
SwTextNode* const pTextNode = nullptr, uno::Reference<text::XText> const& xParent = nullptr,
|
SwTextNode* const pTextNode = nullptr, uno::Reference<text::XText> const& xParent = nullptr,
|
||||||
const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = -1)
|
const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = -1)
|
||||||
: m_rThis(rThis)
|
: m_rThis(rThis)
|
||||||
, m_EventListeners(m_Mutex)
|
|
||||||
, m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH))
|
, m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH))
|
||||||
, m_bIsDescriptor(nullptr == pTextNode)
|
, m_bIsDescriptor(nullptr == pTextNode)
|
||||||
, m_nSelectionStartPos(nSelStart)
|
, m_nSelectionStartPos(nSelStart)
|
||||||
@@ -198,7 +195,8 @@ void SwXParagraph::Impl::Notify(const SfxHint& rHint)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lang::EventObject const ev(xThis);
|
lang::EventObject const ev(xThis);
|
||||||
m_EventListeners.disposeAndClear(ev);
|
std::unique_lock aGuard(m_Mutex);
|
||||||
|
m_EventListeners.disposeAndClear(aGuard, ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1226,7 +1224,8 @@ void SAL_CALL SwXParagraph::dispose()
|
|||||||
SwCursor aCursor( SwPosition( *pTextNode ), nullptr );
|
SwCursor aCursor( SwPosition( *pTextNode ), nullptr );
|
||||||
pTextNode->GetDoc().getIDocumentContentOperations().DelFullPara(aCursor);
|
pTextNode->GetDoc().getIDocumentContentOperations().DelFullPara(aCursor);
|
||||||
lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
|
lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
|
||||||
m_pImpl->m_EventListeners.disposeAndClear(ev);
|
std::unique_lock aGuard2(m_pImpl->m_Mutex);
|
||||||
|
m_pImpl->m_EventListeners.disposeAndClear(aGuard2, ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1234,6 +1233,7 @@ void SAL_CALL SwXParagraph::addEventListener(
|
|||||||
const uno::Reference< lang::XEventListener > & xListener)
|
const uno::Reference< lang::XEventListener > & xListener)
|
||||||
{
|
{
|
||||||
// no need to lock here as m_pImpl is const and container threadsafe
|
// 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);
|
m_pImpl->m_EventListeners.addInterface(xListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1241,6 +1241,7 @@ void SAL_CALL SwXParagraph::removeEventListener(
|
|||||||
const uno::Reference< lang::XEventListener > & xListener)
|
const uno::Reference< lang::XEventListener > & xListener)
|
||||||
{
|
{
|
||||||
// no need to lock here as m_pImpl is const and container threadsafe
|
// 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);
|
m_pImpl->m_EventListeners.removeInterface(xListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user