Automatically disconnect all edges when a NodeParam is destroyed

If a NodeParam is destroyed (presumably as the result of its parent Node being
destroyed), any edge objects connecting to another param should be destroyed
or else the edge will be floating referencing a now destroyed object.
This commit is contained in:
itsmattkc
2019-12-02 00:12:45 +11:00
parent e3fdb96281
commit 87ac4dc357
2 changed files with 10 additions and 0 deletions
+8
View File
@@ -37,6 +37,14 @@ NodeParam::NodeParam(const QString &id) :
Q_ASSERT(!id_.isEmpty());
}
NodeParam::~NodeParam()
{
// Clear all connected edges
while (!edges_.isEmpty()) {
DisconnectEdge(edges_.last());
}
}
const QString NodeParam::id()
{
return id_;