Merge pull request #53571 from kleonc/scene-tree-free-objects-queued-during-destruction

This commit is contained in:
Rémi Verschelde 2021-10-08 18:10:11 +02:00 committed by GitHub
commit 034d43def7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -570,7 +570,11 @@ void SceneTree::finalize() {
root = nullptr;
}
// cleanup timers
// In case deletion of some objects was queued when destructing the `root`.
// E.g. if `queue_free()` was called for some node outside the tree when handling NOTIFICATION_PREDELETE for some node in the tree.
_flush_delete_queue();
// Cleanup timers.
for (Ref<SceneTreeTimer> &timer : timers) {
timer->release_connections();
}