sw/source/core/unocore/unoftn.cxx | 16 ++++++++-------- sw/source/core/unocore/unoidx.cxx | 16 ++++++++++------ 2 files changed, 18 insertions(+), 14 deletions(-)
New commits: commit 2d9d0b549e14f3a71414a573d67bd0f63f54dac2 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Dec 21 20:18:33 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Dec 31 17:57:25 2021 +0100 osl::Mutex->std::mutex in SwXDocumentIndexMark Change-Id: Ic6b167ccec8a605a757eb437e2da86e0a290c63a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127802 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 370d41a177d9..e4276a618410 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -32,7 +32,7 @@ #include <osl/mutex.hxx> #include <cppuhelper/interfacecontainer.h> -#include <comphelper/interfacecontainer3.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <comphelper/multicontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <tools/UnitConversion.hxx> @@ -63,6 +63,7 @@ #include <cppuhelper/implbase.hxx> #include <svl/itemprop.hxx> #include <svl/listener.hxx> +#include <mutex> using namespace ::com::sun::star; @@ -1478,7 +1479,6 @@ lcl_TypeToPropertyMap_Mark(const TOXTypes eType) class SwXDocumentIndexMark::Impl final: public SvtListener { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3 SwXDocumentIndexMark & m_rThis; bool m_bInReplaceMark; @@ -1487,7 +1487,8 @@ public: uno::WeakReference<uno::XInterface> m_wThis; SfxItemPropertySet const& m_rPropSet; const TOXTypes m_eTOXType; - ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> m_EventListeners; + std::mutex m_Mutex; // just for OInterfaceContainerHelper4 + ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_EventListeners; bool m_bIsDescriptor; const SwTOXType* m_pTOXType; const SwTOXMark* m_pTOXMark; @@ -1514,7 +1515,6 @@ public: , m_rPropSet( *aSwMapProvider.GetPropertySet(lcl_TypeToPropertyMap_Mark(eType))) , m_eTOXType(eType) - , m_EventListeners(m_Mutex) , m_bIsDescriptor(nullptr == pMark) , m_pTOXType(pType) , m_pTOXMark(pMark) @@ -1555,7 +1555,8 @@ public: OSL_FAIL("ReplaceTOXMark() failed!"); lang::EventObject const ev( static_cast< ::cppu::OWeakObject&>(m_rThis)); - m_EventListeners.disposeAndClear(ev); + std::unique_lock aGuard(m_Mutex); + m_EventListeners.disposeAndClear(aGuard, ev); throw; } } @@ -1573,7 +1574,8 @@ void SwXDocumentIndexMark::Impl::Invalidate() if (xThis.is()) { lang::EventObject const ev(xThis); - m_EventListeners.disposeAndClear(ev); + std::unique_lock aGuard(m_Mutex); + m_EventListeners.disposeAndClear(aGuard, ev); } } EndListeningAll(); @@ -1987,6 +1989,7 @@ SwXDocumentIndexMark::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); } @@ -1995,6 +1998,7 @@ SwXDocumentIndexMark::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); } commit dcd17b7a39608f7b962d330c3ac771e18ed75bc7 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Dec 21 19:08:05 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Dec 31 17:57:05 2021 +0100 osl::Mutex->std::mutex in SwXFootnote Change-Id: I5e831f85a151cff1b5472c4c7560bcb486b98b55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127801 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index c00100d440fc..82c7f2555243 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -19,12 +19,12 @@ #include <sal/config.h> -#include <comphelper/interfacecontainer3.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <svl/listener.hxx> -#include <osl/mutex.hxx> +#include <mutex> #include <unofootnote.hxx> #include <unotextrange.hxx> @@ -61,15 +61,13 @@ GetSupportedServiceNamesImpl( class SwXFootnote::Impl : public SvtListener { -private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3 - public: SwXFootnote& m_rThis; uno::WeakReference<uno::XInterface> m_wThis; const bool m_bIsEndnote; - ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> m_EventListeners; + std::mutex m_Mutex; // just for OInterfaceContainerHelper4 + ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_EventListeners; bool m_bIsDescriptor; SwFormatFootnote* m_pFormatFootnote; OUString m_sLabel; @@ -79,7 +77,6 @@ public: const bool bIsEndnote) : m_rThis(rThis) , m_bIsEndnote(bIsEndnote) - , m_EventListeners(m_Mutex) , m_bIsDescriptor(nullptr == pFootnote) , m_pFormatFootnote(pFootnote) { @@ -115,7 +112,8 @@ void SwXFootnote::Impl::Invalidate() return; } lang::EventObject const ev(xThis); - m_EventListeners.disposeAndClear(ev); + std::unique_lock aGuard(m_Mutex); + m_EventListeners.disposeAndClear(aGuard, ev); } void SwXFootnote::Impl::Notify(const SfxHint& rHint) @@ -379,6 +377,7 @@ SwXFootnote::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); } @@ -387,6 +386,7 @@ SwXFootnote::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); }