sw/source/core/unocore/unotbl.cxx | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
New commits: commit b3329c10cca25eb393430d9d9f10ebd9e3c1240b Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Sun Oct 30 08:03:47 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Oct 30 11:26:19 2022 +0100 tdf#126788 check for listeners first cheaper than the WeakReference check Change-Id: I2caaa80ed1f68c840758db2ad1fb97237606bbf1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142033 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index f06befaad2ee..2201a3ebb688 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -3084,21 +3084,22 @@ void SwXTextTable::Impl::Notify(const SfxHint& rHint) m_pFrameFormat = nullptr; EndListeningAll(); } + std::unique_lock aGuard(m_Mutex); + if (m_EventListeners.getLength(aGuard) == 0 && m_ChartListeners.getLength(aGuard) == 0) + return; 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 - if(!m_pFrameFormat) - { - lang::EventObject const ev(xThis); - std::unique_lock aGuard(m_Mutex); - m_EventListeners.disposeAndClear(aGuard, ev); - m_ChartListeners.disposeAndClear(aGuard, ev); - } - else - { - std::unique_lock aGuard(m_Mutex); - lcl_SendChartEvent(aGuard, xThis, m_ChartListeners); - } + // fdo#72695: if UNO object is already dead, don't revive it with event + if (!xThis) + return; + if(!m_pFrameFormat) + { + lang::EventObject const ev(xThis); + m_EventListeners.disposeAndClear(aGuard, ev); + m_ChartListeners.disposeAndClear(aGuard, ev); + } + else + { + lcl_SendChartEvent(aGuard, xThis, m_ChartListeners); } }