FIX: disordered support interfaces in tree support

Can't delete nodes with no children, otherwise the parent-child relations may be corrupted.

Jira: STUDIO-3737, MAK-1557

Change-Id: I1de39e182bac4a55a8739c00e59fdf7b9b5e4dfb
(cherry picked from commit 8ad53b9fc16362e5bac1f649b53f4f0eba1edc1d)
This commit is contained in:
Arthur 2023-08-09 16:58:45 +08:00 committed by lane.wei
parent 0bfc42989b
commit 92a740a112

View File

@ -3058,21 +3058,7 @@ void TreeSupport::drop_nodes(std::vector<std::vector<Node*>>& contact_nodes)
}
}
}
#if 1
// delete nodes with no children (means either it's a single layer nodes, or the branch has been deleted but not completely)
for (size_t layer_nr = contact_nodes.size() - 1; layer_nr > 0; layer_nr--){
auto layer_contact_nodes = contact_nodes[layer_nr];
for (Node *p_node : layer_contact_nodes) {
if (p_node->child==nullptr) {
std::vector<Node *>::iterator to_erase = std::find(contact_nodes[layer_nr].begin(), contact_nodes[layer_nr].end(), p_node);
if (to_erase != contact_nodes[layer_nr].end()) {
to_free_node_set.insert(*to_erase);
contact_nodes[layer_nr].erase(to_erase);
}
}
}
}
#endif
BOOST_LOG_TRIVIAL(debug) << "after m_avoidance_cache.size()=" << m_ts_data->m_avoidance_cache.size();
for (Node *node : to_free_node_set)