summaryrefslogtreecommitdiffstats
path: root/src/knotholder.cpp
diff options
context:
space:
mode:
authorNathan Lee <2431820-nathanal@users.noreply.gitlab.com>2019-05-25 10:14:13 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2019-07-15 10:35:33 +0000
commitcdfe88fdf72647144a10d3230c663977364f3d00 (patch)
tree0aad4da5f080ed20e24cc70581194f8012440d35 /src/knotholder.cpp
parentOverride navigation in swatch/gradient list (diff)
downloadinkscape-cdfe88fdf72647144a10d3230c663977364f3d00.tar.gz
inkscape-cdfe88fdf72647144a10d3230c663977364f3d00.zip
Check knot's pattern still exists before update
Stop crash when pattern changed via swatch palette, and knot is still present. https://gitlab.com/inkscape/inkscape/issues/70
Diffstat (limited to 'src/knotholder.cpp')
-rw-r--r--src/knotholder.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/knotholder.cpp b/src/knotholder.cpp
index 9594a233f..d12f61a98 100644
--- a/src/knotholder.cpp
+++ b/src/knotholder.cpp
@@ -105,8 +105,15 @@ void KnotHolder::updateControlSizes()
void KnotHolder::update_knots()
{
- for (auto e : entity) {
- e->update_knot();
+ for (auto e = entity.begin(); e != entity.end(); ) {
+ // check if pattern was removed without deleting the knot
+ if ((*e)->knot_missing()) {
+ delete (*e);
+ e = entity.erase(e);
+ } else {
+ (*e)->update_knot();
+ ++e;
+ }
}
}