Crash when passing an introspected function as a callback argument
System information
What is your operating system and version? N/A
What is your version of GJS? 1.75.1
Bug information
Steps to reproduce
imports.gi.versions.Gtk = '3.0';
const {GLib, Gtk} = imports.gi;
Gtk.init(null);
GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1, Gtk.main_quit);
Gtk.main();
Causes a different crash but I believe it's the same underlying cause:
imports.gi.versions.Gtk = '3.0';
const {Gtk} = imports.gi;
Gtk.init(null);
const win = new Gtk.Window();
win.connect('destroy', Gtk.main_quit);
win.show();
Gtk.main();
Current behaviour
The first script crashes in ArgCache::CallbackIn::in()
because JS_GetObjectFunction(&value.toObject())
returns null, and so a RootedFunction holding null is passed to GjsCallbackTrampoline::create()
, which fails an assertion.
The second script crashes in Gjs::Closure::marshal()
, in JSAutoRealm ar(context, JS_GetFunctionObject(func))
because func
is null.
Expected behaviour
This used to work, I suspect it's a regression with the argument cache.