mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 14:12:51 +00:00
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:
parent
e3617cb187
commit
4820dfc570
@ -2572,8 +2572,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 {
|
||||
|
Loading…
Reference in New Issue
Block a user