mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
GDScript call stack as reverse linked list with fixed coroutines
* GDScript call stack as reverse linked list with issues fixed (originally proposed in 91006). * Fix coroutine issues with call stack by resuming async call chain inside `GDScriptFunction::call()`. * This fixes corrupted line numbers for coroutines in the debugger and backtrace (106489). Co-authored-by: Juan Linietsky <reduzio@gmail.com>
This commit is contained in:
parent
e1b4101e34
commit
a095c5e3fa
7 changed files with 90 additions and 79 deletions
|
@ -223,6 +223,7 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) {
|
|||
GDScriptFunctionState *gdfs = Object::cast_to<GDScriptFunctionState>(ret);
|
||||
if (gdfs && gdfs->function == function) {
|
||||
completed = false;
|
||||
// Keep the first state alive via reference.
|
||||
gdfs->first_state = first_state.is_valid() ? first_state : Ref<GDScriptFunctionState>(this);
|
||||
}
|
||||
}
|
||||
|
@ -231,14 +232,6 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) {
|
|||
state.result = Variant();
|
||||
|
||||
if (completed) {
|
||||
if (first_state.is_valid()) {
|
||||
first_state->emit_signal(SNAME("completed"), ret);
|
||||
} else {
|
||||
emit_signal(SNAME("completed"), ret);
|
||||
}
|
||||
|
||||
GDScriptLanguage::get_singleton()->exit_function();
|
||||
|
||||
_clear_stack();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue