Should pay attention to GI list-type annotations for properties
@ptomato
Submitted by Philip Chimento Link to original bug (#727787)
Description
As described in this doc page: https://wiki.gnome.org/action/show/Projects/GObjectIntrospection/Annotations?action=show&redirect=GObjectIntrospection%2FAnnotations
One should be able to define GList-typed GObject properties using g_param_spec_pointer() and the (type GList(SomeObject)) annotation. This works with GObject Introspection 1.40 but not with GJS.
Here's a gist containing a sample FooBar project to illustrate the problem: https://gist.github.com/ptomato/10070608
The generated .gir seems to be correct:
<property name="empty-list" transfer-ownership="none">
<doc xml:space="preserve">Empty list with no #GObject objects inside.</doc>
<type name="GLib.List" c:type="gpointer">
<type name="GObject.Object"/>
</type>
</property>
<property name="full-list" transfer-ownership="none">
<doc xml:space="preserve">List with some #GObject objects inside.</doc>
<type name="GLib.List" c:type="gpointer">
<type name="GObject.Object"/>
</type>
</property>
However, running the attached test.js after make install does the wrong thing:
Empty list property:
null
Empty list getter function:
[ ]
Full list property:
Error: Can't convert non-null pointer to JS value
Full list getter function:
[ [object instance proxy GIName:GObject.Object jsobj@0xb460ace0 native@0x8721b00],[object instance proxy GIName:GObject.Object jsobj@0xb460ad00 native@0x8721b20],[object instance proxy GIName:GObject.Object jsobj@0xb460ad20 native@0x8721b40] ]