mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-10 00:52:11 +01:00
Delete children Nodes in Node's destructor. Also delet the tree in NodeTree's destructor.
This commit is contained in:
parent
bd93a2a9ce
commit
10effc3971
@ -110,4 +110,9 @@ Node::Node() :
|
||||
}
|
||||
|
||||
Node::~Node() {
|
||||
for (int i = 0; i < _children.size(); ++i) {
|
||||
delete _children[i];
|
||||
}
|
||||
|
||||
_children.clear();
|
||||
}
|
@ -8,9 +8,9 @@ Node *NodeTree::get_root() {
|
||||
}
|
||||
|
||||
void NodeTree::set_root(Node *root) {
|
||||
if (_root_node) {
|
||||
_root_node->set_tree(nullptr);
|
||||
}
|
||||
if (_root_node) {
|
||||
_root_node->set_tree(nullptr);
|
||||
}
|
||||
|
||||
_root_node = root;
|
||||
|
||||
@ -20,11 +20,16 @@ void NodeTree::set_root(Node *root) {
|
||||
}
|
||||
|
||||
void NodeTree::send_update(float delta) {
|
||||
//todo
|
||||
// todo
|
||||
}
|
||||
|
||||
NodeTree::NodeTree() : Object() {
|
||||
NodeTree::NodeTree() :
|
||||
Object() {
|
||||
}
|
||||
|
||||
NodeTree::~NodeTree() {
|
||||
if (_root_node) {
|
||||
delete _root_node;
|
||||
_root_node == nullptr;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user