summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-08 18:10:11 +0200
committerGitHub <noreply@github.com>2021-10-08 18:10:11 +0200
commit034d43def74c83e1d64db2c5c151f2c9da68810f (patch)
treed590d37fc11ef79ca66189fa1416f5c2f6352d4b
parent26b3aff01d5b9832ced1fb2fcdd14abeab4ca4b8 (diff)
parent23dac247895cc92288f7d69c24aab65a0717735c (diff)
Merge pull request #53571 from kleonc/scene-tree-free-objects-queued-during-destruction
-rw-r--r--scene/main/scene_tree.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 3d07e4473d..a122241cd0 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -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();
}