include/svx/sdr/contact/viewobjectcontact.hxx | 1 + svx/source/sdr/contact/viewobjectcontact.cxx | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-)
New commits: commit 1c8b8d1fb80e6445aaeca2f2df6816d223277dbc Author: Noel Grandin <[email protected]> AuthorDate: Fri Nov 7 16:38:40 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Nov 8 13:11:06 2025 +0100 tdf#168928 Draw object not removed from the view after delete regression from commit e6a8c40e5051363d5825bd09131b86cf8a2b659b Author: Noel Grandin <[email protected]> Date: Tue Sep 30 14:54:37 2025 +0200 tdf#116975 Laggy behavior when clicking between table cells in impress Change-Id: I9f430aece90badae7e0911ef82fffa84fb707755 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193582 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/include/svx/sdr/contact/viewobjectcontact.hxx b/include/svx/sdr/contact/viewobjectcontact.hxx index eab0aed2c093..26154d80f63f 100644 --- a/include/svx/sdr/contact/viewobjectcontact.hxx +++ b/include/svx/sdr/contact/viewobjectcontact.hxx @@ -65,6 +65,7 @@ private: // This bool gets set when the object gets invalidated by ActionChanged() and // can be used from the OC to late-invalidates bool mbLazyInvalidate : 1; + mutable bool mbInvalidateViewOnDestruct : 1; protected: // make redirector a protected friend, it needs to call createPrimitives as default action diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index d5cf6e6ae7f7..960d4a8db74e 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -155,7 +155,8 @@ ViewObjectContact::ViewObjectContact(ObjectContact& rObjectContact, ViewContact& : mrObjectContact(rObjectContact), mrViewContact(rViewContact), mnActionChangedCount(0), - mbLazyInvalidate(false) + mbLazyInvalidate(false), + mbInvalidateViewOnDestruct(false) { // make the ViewContact remember me mrViewContact.AddViewObjectContact(*this); @@ -166,11 +167,21 @@ ViewObjectContact::ViewObjectContact(ObjectContact& rObjectContact, ViewContact& ViewObjectContact::~ViewObjectContact() { - // if the object range is empty, then we have never had the primitive range change, so nothing to invalidate - if (!maObjectRange.isEmpty()) + if (mbInvalidateViewOnDestruct) { - // invalidate in view - GetObjectContact().InvalidatePartOfView(maObjectRange); + // used cached object range to limit invalidation + if (!maObjectRange.isEmpty()) + { + // invalidate in view + GetObjectContact().InvalidatePartOfView(maObjectRange); + } + else + { + // we do not currently have cached range information, so just invalidate the whole viewport + const drawinglayer::geometry::ViewInformation2D& rViewInfo2D = GetObjectContact().getViewInformation2D(); + if (!rViewInfo2D.getViewport().isEmpty()) + GetObjectContact().InvalidatePartOfView(rViewInfo2D.getViewport()); + } } // delete PrimitiveAnimation @@ -518,6 +529,7 @@ drawinglayer::primitive2d::Primitive2DContainer const & ViewObjectContact::getPr const_cast< ViewObjectContact* >(this)->checkForPrimitive2DAnimations(); const_cast< ViewObjectContact* >(this)->maObjectRange.reset(); + mbInvalidateViewOnDestruct = true; } // return current Primitive2DContainer
