summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-10-29 13:23:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-10-29 18:10:10 +0200
commitebe2a3e948df1622f3532afeeaeb31d1066d40c2 (patch)
tree08429948d03d1cb56c68ea325acf2b2e70adfd6c
parent75e16fdc9d111aad9663b7de1b229fbd2a61b51e (diff)
tdf#126788 check if we need to fire an event
before calling the rather expensive weak->reference conversion Change-Id: I83f22ae3a016f4d44bf1589339d6dc31579cc9e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142019 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 866d5aad23f2..7f8aa247260c 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -189,14 +189,17 @@ void SwXParagraph::Impl::Notify(const SfxHint& rHint)
if(rHint.GetId() == SfxHintId::Dying)
{
m_pTextNode = nullptr;
- uno::Reference<uno::XInterface> const xThis(m_wThis);
- if (!xThis.is())
- { // fdo#72695: if UNO object is already dead, don't revive it with event
- return;
- }
- lang::EventObject const ev(xThis);
std::unique_lock aGuard(m_Mutex);
- m_EventListeners.disposeAndClear(aGuard, ev);
+ if (m_EventListeners.getLength(aGuard) != 0)
+ {
+ uno::Reference<uno::XInterface> const xThis(m_wThis);
+ if (!xThis.is())
+ { // fdo#72695: if UNO object is already dead, don't revive it with event
+ return;
+ }
+ lang::EventObject const ev(xThis);
+ m_EventListeners.disposeAndClear(aGuard, ev);
+ }
}
}