summaryrefslogtreecommitdiffstats
path: root/src/knotholder.cpp
diff options
context:
space:
mode:
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;
+ }
}
}