Merge pull request #53572 from kleonc/scene-tree-free-objects-queued-during-destruction-3x

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

View file

@ -621,7 +621,11 @@ void SceneTree::finish() {
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 (List<Ref<SceneTreeTimer>>::Element *E = timers.front(); E; E = E->next()) {
E->get()->release_connections();
}