From d13e327abe7eb40a40f7be098d2c853ae9a7eaeb Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Thu, 15 Dec 2022 19:09:09 +0800 Subject: [PATCH] Fix possible Tween leak on exit (cherry picked from commit e173710963c3316833ac2e2c26ab3830551fd790) --- scene/main/scene_tree.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 8a0240069b9..fe94a7cb8e0 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -749,6 +749,12 @@ void SceneTree::finish() { E->get()->release_connections(); } timers.clear(); + + // Cleanup tweens. + for (List>::Element *E = tweens.front(); E; E = E->next()) { + E->get()->clear(); + } + tweens.clear(); } void SceneTree::quit(int p_exit_code) {