Let queue_free() work on nodes which are not in the scene tree

In practice such nodes could directly be free()'ed, but this little change
prevents users from leaking memory by mistake.
Closes #9074.
This commit is contained in:
Rémi Verschelde 2017-09-20 21:49:46 +02:00 committed by Xavier Sellier
parent 298548df4e
commit fe04134138
1 changed files with 5 additions and 2 deletions

View File

@ -1975,8 +1975,11 @@ void Node::print_stray_nodes() {
void Node::queue_delete() {
ERR_FAIL_COND(!is_inside_tree());
get_tree()->queue_delete(this);
if (is_inside_tree()) {
get_tree()->queue_delete(this);
} else {
SceneTree::get_singleton()->queue_delete(this);
}
}
Array Node::_get_children() const {