From 689257e9bb620da1dc0802eb9c71f385246c793b Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Wed, 18 Oct 2023 16:36:20 +0200 Subject: [PATCH] this allow use the clear way in knotholder with safe removal inside, you remove once, if same knotholder entities remove again the knotholdder do noting --- src/ui/knot/knot-holder.cpp | 5 +++++ src/ui/knot/knot-holder.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ui/knot/knot-holder.cpp b/src/ui/knot/knot-holder.cpp index 9d5aa607ef..6eb9749a1e 100644 --- a/src/ui/knot/knot-holder.cpp +++ b/src/ui/knot/knot-holder.cpp @@ -76,10 +76,15 @@ KnotHolder::~KnotHolder() { void KnotHolder::clear() { + if (clearing) { // allow clear again inside entities also + return; + } + clearing = true; for (auto & i : entity) { delete i; } entity.clear(); // is this necessary? + clearing = false; } void diff --git a/src/ui/knot/knot-holder.h b/src/ui/knot/knot-holder.h index d28da672c5..82f1dbec18 100644 --- a/src/ui/knot/knot-holder.h +++ b/src/ui/knot/knot-holder.h @@ -102,7 +102,7 @@ protected: bool local_change; ///< if true, no need to recreate knotholder if repr was changed. bool dragging; - + bool clearing = false; Geom::Affine _edit_transform; Inkscape::auto_connection _watch_fill; Inkscape::auto_connection _watch_stroke; -- GitLab