summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-12-21 17:44:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-31 19:56:06 +0100
commit1b3c8f4a6997fdf5685639cc70947c6edb1d85fc (patch)
treef55fdcd623340e22e8f775353a1583054921f116 /sw
parentc859b4aa48956cbf5ff41280b0008456e8f5189c (diff)
osl::Mutex->std::mutex in SwXBookmark
Change-Id: Ic3deffdafb62111f20540c1785824e5cd66a1623 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127813 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unobkm.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 60d6c47d50b2..347038a09ba0 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -19,7 +19,7 @@
#include <unobookmark.hxx>
-#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -44,12 +44,10 @@ using namespace ::com::sun::star;
class SwXBookmark::Impl
: public SvtListener
{
-private:
- ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
-
public:
uno::WeakReference<uno::XInterface> m_wThis;
- ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> m_EventListeners;
+ std::mutex m_Mutex; // just for OInterfaceContainerHelper3
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_EventListeners;
SwDoc* m_pDoc;
::sw::mark::IMark* m_pRegisteredBookmark;
OUString m_sMarkName;
@@ -57,8 +55,7 @@ public:
OUString m_HideCondition;
Impl( SwDoc *const pDoc )
- : m_EventListeners(m_Mutex)
- , m_pDoc(pDoc)
+ : m_pDoc(pDoc)
, m_pRegisteredBookmark(nullptr)
, m_bHidden(false)
{
@@ -83,7 +80,8 @@ void SwXBookmark::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);
}
}
@@ -302,6 +300,7 @@ void SAL_CALL SwXBookmark::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);
}
@@ -309,6 +308,7 @@ void SAL_CALL SwXBookmark::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);
}