GNOME Bugzilla – Bug 727787
Should pay attention to GI list-type annotations for properties
Last modified: 2018-01-27 11:56:23 UTC
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] ]
It's not possible for us to store raw pointers.
gobject-introspection already knows that those are not raw pointers though, since the annotation will manually propagate down the actual GType...
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gjs/issues/83.