From 5df5cb9ff4917bff06d108c271f9a4c0158c0853 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Wed, 15 Feb 2023 12:03:55 +0800 Subject: [PATCH] FIX: smooth_nodes may crash due to broken parent-child chain Change-Id: I770df691b41c6f18a0cb97e49e9e2251afe02e1a (cherry picked from commit 2b5cdf0337fff277f7b949da568d6cdaa28a0d35) --- src/libslic3r/TreeSupport.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/TreeSupport.cpp b/src/libslic3r/TreeSupport.cpp index 81749e81c..84bec8acf 100644 --- a/src/libslic3r/TreeSupport.cpp +++ b/src/libslic3r/TreeSupport.cpp @@ -3000,7 +3000,11 @@ void TreeSupport::drop_nodes(std::vector>& contact_nodes) std::vector::iterator to_erase = std::find(contact_nodes[i_layer].begin(), contact_nodes[i_layer].end(), i_node); if (to_erase != contact_nodes[i_layer].end()) { - to_free_node_set.insert(*to_erase); + // update the parent-child chain + if(i_node->parent) + i_node->parent->child = i_node->child; + if(i_node->child) + i_node->child->parent = i_node->parent; contact_nodes[i_layer].erase(to_erase); to_free_node_set.insert(i_node);