diff options
author | kleonc <9283098+kleonc@users.noreply.github.com> | 2021-10-08 16:37:03 +0200 |
---|---|---|
committer | kleonc <9283098+kleonc@users.noreply.github.com> | 2021-10-08 16:45:55 +0200 |
commit | 23dac247895cc92288f7d69c24aab65a0717735c (patch) | |
tree | d590d37fc11ef79ca66189fa1416f5c2f6352d4b | |
parent | 26b3aff01d5b9832ced1fb2fcdd14abeab4ca4b8 (diff) |
Delete objects enqueued for deletion during SceneTree destruction
-rw-r--r-- | scene/main/scene_tree.cpp | 6 |
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(); } |