From 51844febee705f79a52e6b65bc9ada88d99fcae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Sun, 6 Sep 2020 22:26:16 +0200 Subject: [PATCH] Avoid warning about harmless unfulfilled yields --- modules/gdscript/gdscript.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 7f89f2037c4..92810b714ac 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -975,8 +975,10 @@ GDScript::~GDScript() { GDScriptLanguage::get_singleton()->lock->lock(); } while (SelfList *E = pending_func_states.first()) { - E->self()->_clear_stack(); + // Order matters since clearing the stack may already cause + // the GDSCriptFunctionState to be destroyed and thus removed from the list. pending_func_states.remove(E); + E->self()->_clear_stack(); } if (GDScriptLanguage::get_singleton()->lock) { GDScriptLanguage::get_singleton()->lock->unlock(); @@ -1404,8 +1406,10 @@ GDScriptInstance::~GDScriptInstance() { #endif while (SelfList *E = pending_func_states.first()) { - E->self()->_clear_stack(); + // Order matters since clearing the stack may already cause + // the GDSCriptFunctionState to be destroyed and thus removed from the list. pending_func_states.remove(E); + E->self()->_clear_stack(); } if (script.is_valid() && owner) {