diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-12-22 20:12:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-31 17:57:59 +0100 |
commit | aa29327fcab653f8c4d3de7b2ed6d691219b92ea (patch) | |
tree | f2ea4fb0e12c07ececb5da1013538fe1e63d7657 /sw/source | |
parent | 68647c78eaa9171befe050e4d0a1d2dce3b732e1 (diff) |
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>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/unocore/unoparagraph.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 92ed2214d565..658fa7aac3eb 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -19,7 +19,7 @@ #include <unoparagraph.hxx> -#include <comphelper/interfacecontainer3.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/supportsservice.hxx> #include <osl/diagnose.h> @@ -112,13 +112,11 @@ static beans::PropertyState lcl_SwXParagraph_getPropertyState( class SwXParagraph::Impl : public SvtListener { -private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3 - public: SwXParagraph& m_rThis; 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; bool m_bIsDescriptor; sal_Int32 m_nSelectionStartPos; @@ -131,7 +129,6 @@ public: SwTextNode* const pTextNode = nullptr, uno::Reference<text::XText> const& xParent = nullptr, const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = -1) : m_rThis(rThis) - , m_EventListeners(m_Mutex) , m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH)) , m_bIsDescriptor(nullptr == pTextNode) , m_nSelectionStartPos(nSelStart) @@ -198,7 +195,8 @@ void SwXParagraph::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); } } @@ -1226,7 +1224,8 @@ void SAL_CALL SwXParagraph::dispose() SwCursor aCursor( SwPosition( *pTextNode ), nullptr ); pTextNode->GetDoc().getIDocumentContentOperations().DelFullPara(aCursor); 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) { // 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); } @@ -1241,6 +1241,7 @@ void SAL_CALL SwXParagraph::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); } |