sw/inc/swcrsr.hxx                       |    8 ++++----
 sw/source/core/unocore/unoparagraph.cxx |   17 ++++++++++-------
 2 files changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 32b0b79c3f71e4aca995aa92ee519d93a3ca2b3b
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sat Oct 29 11:10:13 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Oct 29 18:10:23 2022 +0200

    tdf#126788 replace dynamic_cast with static_cast
    
    no need to dynamic_cast here
    
    Change-Id: I36b2c20c0f8743c39a8b8b0f14a9eb2ee6effee7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142015
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
index 486507b23c4e..e2b5ad10966a 100644
--- a/sw/inc/swcrsr.hxx
+++ b/sw/inc/swcrsr.hxx
@@ -216,10 +216,10 @@ public:
 
     sal_Int32 GetCursorRowSpanOffset() const { return m_nRowSpanOffset; }
 
-    SwCursor* GetNext()             { return dynamic_cast<SwCursor 
*>(GetNextInRing()); }
-    const SwCursor* GetNext() const { return dynamic_cast<SwCursor const 
*>(GetNextInRing()); }
-    SwCursor* GetPrev()             { return dynamic_cast<SwCursor 
*>(GetPrevInRing()); }
-    const SwCursor* GetPrev() const { return dynamic_cast<SwCursor const 
*>(GetPrevInRing()); }
+    SwCursor* GetNext()             { return static_cast<SwCursor 
*>(GetNextInRing()); }
+    const SwCursor* GetNext() const { return static_cast<SwCursor const 
*>(GetNextInRing()); }
+    SwCursor* GetPrev()             { return static_cast<SwCursor 
*>(GetPrevInRing()); }
+    const SwCursor* GetPrev() const { return static_cast<SwCursor const 
*>(GetPrevInRing()); }
 };
 
 /**
commit ebe2a3e948df1622f3532afeeaeb31d1066d40c2
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sat Oct 29 13:23:28 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Oct 29 18:10:10 2022 +0200

    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.gran...@collabora.co.uk>

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);
+        }
     }
 }
 

Reply via email to