Geequlim / ECMAScript

Javascript binding for godotengine
MIT License
959 stars 84 forks source link

[4.1-v0.0.17] Signal arguments makes it crash #175

Open why-try313 opened 11 months ago

why-try313 commented 11 months ago

Concerned version

4.1-v0.0.17-alpha-20231003

Problem

It seems that any function passing arguments makes the application crash, both on editor connection and using the .connect(str, fn) method

What works:

What doesn't work:

Observations

1) It seems that after re-establishing binding_script.js with some modifications the connect method in code passes the arguments array

// From
return godot_object_connect.apply(this, [signal, target, method_name, params, flags]);
// To
return godot_object_connect.apply(this, [signal, target[method_name], params, flags]);
/// Apply this to all Object.defineProperty return statements

2) Connecting a method on the editor doesn't match the number of arguments since MethodInfo doesn't set the number of arguments in /quickjs/quickjs_binder.cpp:L1871 connect issued

Note : The parameters seem to be received by the functions since they are logged on the terminal that runs godot but freezes the program completly after printing them

fire commented 11 months ago

Maybe we are not passing the arguments correctly with 0 count.

why-try313 commented 11 months ago

Arguments are returned, but it looks like the signal callback fails.

Another problem that might be Signal related, TextEdit completly ignores keyboard inputs or clicks

After further testing: It turns out the crash only occurs on one of these nodes input_event(camera, event, position, normal, shape_idx),

that being said, child_entered_tree(Node) still doesn't return the node

To illustrate, xkill was made after freezing: xkill

fire commented 11 months ago

I wonder if it's Camera3D access that's crashing? The rest are primitive types.

nmerget commented 10 months ago

Another problem that might be Signal related, TextEdit completly ignores keyboard inputs or clicks

If you add a script on a TextEdit it stops working... If you place the script on a Control above and trigger the signal from TextEdit to the Control it isn't ignoring the clicks

--> This is a bug, we should check why we lose any input events if we attach a .mjs :(