nodeview: ensure node is cleanly removed at all times

This commit is contained in:
itsmattkc
2021-07-23 23:38:24 -07:00
parent c356c241b9
commit 3f785f30fd
+8 -8
View File
@@ -1041,6 +1041,13 @@ void NodeView::OpenSelectedNodeInViewer()
void NodeView::RemoveNode(Node *node)
{
for (const Node::OutputConnection &oc : node->output_connections()) {
scene_.RemoveEdge(oc.first, oc.second);
}
for (auto it=node->input_connections().cbegin(); it!=node->input_connections().cend(); it++) {
scene_.RemoveEdge(it->second, it->first);
}
positions_.remove(scene_.item_map().value(node));
scene_.RemoveNode(node);
}
@@ -1100,14 +1107,7 @@ void NodeView::RemoveNodePosition(Node *node, Node *relative)
}
if (!found) {
for (const Node::OutputConnection &oc : node->output_connections()) {
scene_.RemoveEdge(oc.first, oc.second);
}
for (auto it=node->input_connections().cbegin(); it!=node->input_connections().cend(); it++) {
scene_.RemoveEdge(it->second, it->first);
}
positions_.remove(item);
scene_.RemoveNode(node);
RemoveNode(node);
}
}