Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling enum's nonexisting method causes a crash #61466

Closed
miv391 opened this issue May 27, 2022 · 3 comments · Fixed by #69590
Closed

Calling enum's nonexisting method causes a crash #61466

miv391 opened this issue May 27, 2022 · 3 comments · Fixed by #69590

Comments

@miv391
Copy link
Contributor

miv391 commented May 27, 2022

Godot version

v4.0.alpha8.official [cc3ed63]

System information

Windows 10, OpenGL ES 3.0 Renderer: GeForce GTX 1060 6GB/PCIe/SSE2

Issue description

Trying to use enum name as something that has methods, crashes Godot:

kuva

Steps to reproduce

extends Node2D

enum Foo {abc, def}

func _ready():
	Foo.garbage()

Minimal reproduction project

No response

@qarmin
Copy link
Contributor

qarmin commented May 28, 2022

ERROR: Condition "!method" is true. Returning: false
   at: is_builtin_method_vararg (core/variant/variant_call.cpp:1165)
ERROR: Condition "!method" is true. Returning: 0
   at: get_builtin_method_argument_count (core/variant/variant_call.cpp:1091)
ERROR: Condition "!method" is true. Returning: Variant::NIL
   at: get_builtin_method_return_type (core/variant/variant_call.cpp:1144)
ERROR: Condition "!method" is true. Returning: nullptr
   at: get_validated_builtin_method (core/variant/variant_call.cpp:1077)

#0  0x0000000000000000 in ?? ()
#1  0x0000000003641558 in GDScriptFunction::call (this=0xdc5d030, p_instance=0xc737410, p_args=0x7fffffffd5e8, p_argcount=1, r_err=..., p_state=0x0) at modules/gdscript/gdscript_vm.cpp:1981
#2  0x0000000003531edf in GDScriptInstance::callp (this=0xc737410, p_method=..., p_args=0x7fffffffd5e8, p_argcount=1, r_error=...) at modules/gdscript/gdscript.cpp:1543
#3  0x0000000004de94bc in Node::_gdvirtual__process_call<false> (this=0xdc7ba90, arg1=0.14650733333333332) at scene/main/node.h:235
#4  0x0000000004dcc019 in Node::_notification (this=0xdc7ba90, p_notification=17) at scene/main/node.cpp:56
#5  0x00000000028a5112 in Node::_notificationv (this=0xdc7ba90, p_notification=17, p_reversed=false) at scene/main/node.h:45
#6  0x0000000006dcc28f in Object::notification (this=0xdc7ba90, p_notification=17, p_reversed=false) at core/object/object.cpp:847
#7  0x0000000004e0c0cb in SceneTree::_notify_group_pause (this=0xd9d6de0, p_group=..., p_notification=17) at scene/main/scene_tree.cpp:862
#8  0x0000000004e0a33c in SceneTree::process (this=0xd9d6de0, p_time=0.14650733333333332) at scene/main/scene_tree.cpp:453
#9  0x000000000245800f in Main::iteration () at main/main.cpp:2739
#10 0x000000000240c874 in OS_LinuxBSD::run (this=0x7fffffffda60) at platform/linuxbsd/os_linuxbsd.cpp:441
#11 0x0000000002407ab2 in main (argc=2, argv=0x7fffffffdf78) at platform/linuxbsd/godot_linuxbsd.cpp:68

==37239== Jump to the invalid address stated on the next line
==37239==    at 0x0: ???
==37239==    by 0x3531EDE: GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (gdscript.cpp:1543)
==37239==    by 0x4DE94BB: bool Node::_gdvirtual__process_call<false>(double) (node.h:235)
==37239==    by 0x4DCC018: Node::_notification(int) (node.cpp:56)
==37239==    by 0x28A5111: Node::_notificationv(int, bool) (node.h:45)
==37239==    by 0x6DCC28E: Object::notification(int, bool) (object.cpp:847)
==37239==    by 0x4E0C0CA: SceneTree::_notify_group_pause(StringName const&, int) (scene_tree.cpp:862)
==37239==    by 0x4E0A33B: SceneTree::process(double) (scene_tree.cpp:453)
==37239==    by 0x245800E: Main::iteration() (main.cpp:2739)
==37239==    by 0x240C873: OS_LinuxBSD::run() (os_linuxbsd.cpp:441)
==37239==    by 0x2407AB1: main (godot_linuxbsd.cpp:68)
==37239==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

@nabfrew
Copy link
Contributor

nabfrew commented Jul 21, 2022

I think this is the same crash I was getting when i did a typo in Image.FORMAT_RGBAF. I wasn' t using it as a method though (no brackets), so maybe not the same, should I create a new issue?

@anvilfolk
Copy link
Contributor

anvilfolk commented Jan 8, 2023

Just added a fix for this one in #69590 :) Should now generate an error for non-dictionary based methods, e.g. you can still do Foo.size().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants