sd/source/core/sdpage.cxx         |    6 ++----
 vcl/unx/gtk3/a11y/atklistener.cxx |   19 ++++++++++++++++---
 2 files changed, 18 insertions(+), 7 deletions(-)

New commits:
commit 6e63866ea343dea0d1c528c9f7069be44bc034c0
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue May 2 13:55:21 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue May 2 18:58:03 2023 +0200

    tdf#137544 use cheaper method to scan accessibility child list
    
    which shaves 2% off runtime here
    
    Change-Id: If574fad4ff756e03eac8e96cba3226bacb2828ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151267
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/unx/gtk3/a11y/atklistener.cxx 
b/vcl/unx/gtk3/a11y/atklistener.cxx
index cfab14d58a90..f850f450f199 100644
--- a/vcl/unx/gtk3/a11y/atklistener.cxx
+++ b/vcl/unx/gtk3/a11y/atklistener.cxx
@@ -187,15 +187,28 @@ void AtkListener::handleChildRemoved(
     sal_Int32 nIndex = -1;
 
     // Locate the child in the children list
-    size_t n, nmax = m_aChildList.size();
-    for( n = 0; n < nmax; ++n )
+    const size_t nmax = m_aChildList.size();
+    for( size_t n = 0; n < nmax; ++n )
     {
-        if( rxChild == m_aChildList[n] )
+        // Comparing via uno::Reference::operator== is expensive
+        // with lots of objects, so assume we can find it the cheap way
+        // first, which works most of the time.
+        if( rxChild.get() == m_aChildList[n].get() )
         {
             nIndex = n;
             break;
         }
     }
+    // The cheap way failed, find it via the more expensive path
+    if (nIndex == -1)
+        for( size_t n = 0; n < nmax; ++n )
+        {
+            if( rxChild == m_aChildList[n] )
+            {
+                nIndex = n;
+                break;
+            }
+        }
 
     // FIXME: two problems here:
     // a) we get child-removed events for objects that are no real children
commit 0431264c2bfbc73c6b7aa832ad7ac458daaeddc6
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue May 2 13:54:52 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue May 2 18:57:50 2023 +0200

    tdf#137544 no need to broadcast in ~SdPage
    
    It's not clear to me that we ever needed to do this - originally we did
    not, and then we did, but only to avoid UserCall being triggered back
    into us. Then the UserCall was explicitly cleared before the listener
    were notified.
    So just remove the notification again.
    Which removes 10% of the overhead here.
    
    Change-Id: I51f508e86c9785742bb092b7b3ae18f62f1f10f7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151266
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 0b1be5faadd0..230b6b5aef79 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -176,7 +176,8 @@ SdPage::~SdPage()
 
     clearChildNodes(mxAnimationNode);
 
-    // disconnect the UserCall link
+    // disconnect the UserCall link, so we don't get calls
+    // back into this dying object when the child objects die
     SdrObjListIter aIter( this, SdrIterMode::DeepWithGroups );
     while( aIter.IsMore() )
     {
@@ -184,9 +185,6 @@ SdPage::~SdPage()
         if( pChild->GetUserCall() == this )
             pChild->SetUserCall(nullptr);
     }
-
-    // clear SdrObjects with broadcasting
-    ClearSdrObjList();
 }
 
 namespace {

Reply via email to