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
This commit is contained in:
Arthur 2023-08-09 16:58:45 +08:00 committed by Lane.Wei
parent 9fde7861c4
commit 25f9cccf2a
1 changed files with 1 additions and 15 deletions

View File

@ -3062,21 +3062,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)