summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2020-09-06 22:30:46 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2020-09-06 22:30:46 +0200
commitf76a13dea0ac83ebb1dd45b53cb953c87786104d (patch)
treec569117c166b10163695e60cf6849abddec1fc80 /modules
parentd84954a2818e72a96deec1d027028e796f2930f3 (diff)
Avoid warning about harmless unfulfilled yields
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gdscript.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 0263e32c5b..70f0fa315c 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -1044,8 +1044,10 @@ GDScript::~GDScript() {
MutexLock lock(GDScriptLanguage::get_singleton()->lock);
while (SelfList<GDScriptFunctionState> *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();
}
}
@@ -1449,8 +1451,10 @@ GDScriptInstance::~GDScriptInstance() {
MutexLock lock(GDScriptLanguage::get_singleton()->lock);
while (SelfList<GDScriptFunctionState> *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) {