Delete objects enqueued for deletion during SceneTree destruction

This commit is contained in:
kleonc 2021-10-08 16:37:03 +02:00
parent 26b3aff01d
commit 23dac24789
1 changed files with 5 additions and 1 deletions

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();
}