svx/source/sdr/contact/viewobjectcontact.cxx |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 4f98574b78ed1b06bac1d440d75d8ce1ddea8309
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed May 31 13:53:43 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed May 31 17:45:22 2023 +0200

    speed up tab-switching in a calc document with a lot of graphic objects
    
    if we are in the destructor, and we have never painted the object in
    question, then we don't need to do an expensive object-range calculation
    and invalidation
    
    Change-Id: I857c3d927142f4e90d54f79fa6c293731382f0d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152424
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx 
b/svx/source/sdr/contact/viewobjectcontact.cxx
index 82b21d137ef1..bc3b5ee178bd 100644
--- a/svx/source/sdr/contact/viewobjectcontact.cxx
+++ b/svx/source/sdr/contact/viewobjectcontact.cxx
@@ -167,10 +167,14 @@ ViewObjectContact::ViewObjectContact(ObjectContact& 
rObjectContact, ViewContact&
 
 ViewObjectContact::~ViewObjectContact()
 {
-    // invalidate in view
-    if(!getObjectRange().isEmpty())
+    // if the object range is empty, then we have never had the primitive 
range change, so nothing to invalidate
+    if (!maObjectRange.isEmpty())
     {
-        GetObjectContact().InvalidatePartOfView(maObjectRange);
+        // invalidate in view
+        if(!getObjectRange().isEmpty())
+        {
+            GetObjectContact().InvalidatePartOfView(maObjectRange);
+        }
     }
 
     // delete PrimitiveAnimation

Reply via email to