You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Analysis
It is obvious that the bug happens because, in the setter, the assignment objname = val is replaced by the setter itself, creating an infinite calls (until it reaches 1024).
I thought it was a mistake in my code, but I have complied with the example defined in godotengine/godot-proposals#844 (see warns_when_changed).
The reason is that in gdscript_compiler, when parsing the setter (_parse_setter_getter > _parse_block > _parse_expression), the compiler replace the var assignment with its corresponding setter:
Well, in fact it is trying to detect if is is in the setter with the line: is_in_setter = setter_function == codegen.function_name;
However, in my case, codegen.function_name is not defined... I will have a look at how it could happen.
[EDIT] In _parse_function, there is the line: codegen.function_name = func_name;
But not in _parse_setter_getter, where func_name is computed but not set in codegen.function_name
Godot version:
4.0 c647e41
OS/device including version:
Archlinux
Issue description:
The following code provoke a Stack Overflow (Stack Size: 1024)
Steps to reproduce:
Open the reproduction project and launch it
Minimal reproduction project:
SetterStackOverflow.zip
Analysis
It is obvious that the bug happens because, in the setter, the assignment objname = val is replaced by the setter itself, creating an infinite calls (until it reaches 1024).
I thought it was a mistake in my code, but I have complied with the example defined in godotengine/godot-proposals#844 (see warns_when_changed).
The reason is that in gdscript_compiler, when parsing the setter (_parse_setter_getter > _parse_block > _parse_expression), the compiler replace the var assignment with its corresponding setter:
godot/modules/gdscript/gdscript_compiler.cpp
Lines 1024 to 1038 in c647e41
Don't know if there is a way to disable this replacement only if it is dealing with the same setter code.
The text was updated successfully, but these errors were encountered: