nodegraph: delete nodes bottom to top when clearing

This commit is contained in:
itsmattkc
2021-04-11 12:59:25 +10:00
parent a54b42fea4
commit e89e348f6e
2 changed files with 13 additions and 1 deletions
+8 -1
View File
@@ -30,10 +30,17 @@ NodeGraph::NodeGraph()
{
}
NodeGraph::~NodeGraph()
{
Clear();
}
void NodeGraph::Clear()
{
// By deleting the last nodes first, we assume that nodes that are most important are deleted last
// (e.g. Project's ColorManager or ProjectSettingsNode.
while (!node_children_.isEmpty()) {
delete node_children_.first();
delete node_children_.last();
}
}