| 844 | } |
| 845 | |
| 846 | void SceneTree::finalize() { |
| 847 | _flush_delete_queue(); |
| 848 | |
| 849 | _flush_ugc(); |
| 850 | |
| 851 | if (root) { |
| 852 | root->_set_tree(nullptr); |
| 853 | root->_propagate_after_exit_tree(); |
| 854 | memdelete(root); //delete root |
| 855 | root = nullptr; |
| 856 | |
| 857 | // In case deletion of some objects was queued when destructing the `root`. |
| 858 | // E.g. if `queue_free()` was called for some node outside the tree when handling NOTIFICATION_PREDELETE for some node in the tree. |
| 859 | _flush_delete_queue(); |
| 860 | } |
| 861 | |
| 862 | MainLoop::finalize(); |
| 863 | |
| 864 | // Cleanup timers. |
| 865 | for (Ref<SceneTreeTimer> &timer : timers) { |
| 866 | timer->release_connections(); |
| 867 | } |
| 868 | timers.clear(); |
| 869 | |
| 870 | // Cleanup tweens. |
| 871 | for (Ref<Tween> &tween : tweens) { |
| 872 | tween->clear(); |
| 873 | } |
| 874 | tweens.clear(); |
| 875 | } |
| 876 | |
| 877 | void SceneTree::quit(int p_exit_code) { |
| 878 | _THREAD_SAFE_METHOD_ |
nothing calls this directly
no test coverage detected