diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-05-16 14:10:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-16 14:10:29 +0200 |
commit | c41f62c3df85fd71539ae09bd97964e5e367d897 (patch) | |
tree | 7866f880229dc7f5e3e470652ea16c27f47d7687 /modules/gdscript/gdscript_function.cpp | |
parent | b154f445d59f5a6b332311890569fda689fe480b (diff) | |
parent | 102c312497ace1e81bb54b6c3ed3665d16ee1fef (diff) | |
download | redot-engine-c41f62c3df85fd71539ae09bd97964e5e367d897.tar.gz |
Merge pull request #61003 from vnen/gdscript-await-stack-fix
Diffstat (limited to 'modules/gdscript/gdscript_function.cpp')
-rw-r--r-- | modules/gdscript/gdscript_function.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 7c372afac7..deef593f34 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -279,7 +279,8 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) { void GDScriptFunctionState::_clear_stack() { if (state.stack_size) { Variant *stack = (Variant *)state.stack.ptr(); - for (int i = 0; i < state.stack_size; i++) { + // The first 3 are special addresses and not copied to the state, so we skip them here. + for (int i = 3; i < state.stack_size; i++) { stack[i].~Variant(); } state.stack_size = 0; @@ -300,8 +301,6 @@ GDScriptFunctionState::GDScriptFunctionState() : } GDScriptFunctionState::~GDScriptFunctionState() { - _clear_stack(); - { MutexLock lock(GDScriptLanguage::singleton->lock); scripts_list.remove_from_list(); |