From 8052d8eadcfa0201ee0ec7a1230bbf91c470da79 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 10 Mar 2018 15:09:42 +0100 Subject: Speed up removing items from SPCanvasGroup This shortcut is possible as there are no duplicate items in SPCanvasGroup. It reverts to the behavior before ab7cc89c4f9f938575e777530c31312cde116208 which introduced a severe performance regression when deselecting paths with many nodes while the node tool is active. Fixed bugs: - https://bugs.launchpad.net/inkscape/+bug/1652100 - https://bugs.launchpad.net/inkscape/+bug/1745763 --- src/display/sp-canvas.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 20ad27bf5..c717bc7ae 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -905,9 +905,12 @@ void SPCanvasGroup::add(SPCanvasItem *item) void SPCanvasGroup::remove(SPCanvasItem *item) { - g_return_if_fail(item != NULL); - items.remove(item); + + auto position = std::find(items.begin(), items.end(), item); + if (position != items.end()) { + items.erase(position); + } // Unparent the child item->parent = NULL; -- cgit v1.2.3