nodegraph: delete nodes bottom to top when clearing
This commit is contained in:
+8
-1
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,11 @@ public:
|
||||
*/
|
||||
NodeGraph();
|
||||
|
||||
/**
|
||||
* @brief NodeGraph Destructor
|
||||
*/
|
||||
virtual ~NodeGraph() override;
|
||||
|
||||
/**
|
||||
* @brief Destructively destroys all nodes in the graph
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user