Pass-by-reference GValue arguments do not work right
Submitted by Simon Feltman
Link to original bug (#703412)
Description
There are a handful of methods which take GValue pointers and expect a caller allocated GValue which has been initialized. These methods then fill out the GValue, sort of a quasi in/out arg. Methods which follow this pattern (get_property is statically bound so obviously not a problem):
- g_object_get_property
- gtk_style_context_get_style_property
- gtk_widget_style_get_property
- gtk_container_child_get_property
Example script showing problem:
const Gtk = imports.gi.Gtk;
const GObject = imports.gi.GObject;
Gtk.init(null);
let win = new Gtk.ScrolledWindow();
let value = new GObject.Value();
value.init(GObject.TYPE_BOOLEAN);
win.style_get_property("scrollbars-within-bevel", value);
(gjs:12694): Gtk-WARNING **: can't retrieve style property `scrollbars-within-bevel' of type `gboolean' as value of type `GValue'
Gjs seems to be expecting a native JS boolean which it converts to a GValue for the argument. This is obviously not very helpful as it won't actually retrieve the value for the Gjs developer:
win.style_get_property("scrollbars-within-bevel", true);