After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 780758 - flowbox: bind_model passes wrong reference to create_widget_func in bindings
flowbox: bind_model passes wrong reference to create_widget_func in bindings
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Language Bindings
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-03-31 11:29 UTC by Felipe Borges
Modified: 2017-09-27 11:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gjs-flowbox.js (538 bytes, application/javascript)
2017-03-31 11:29 UTC, Felipe Borges
  Details
python-flowbox.py (426 bytes, text/x-python)
2017-03-31 11:29 UTC, Felipe Borges
  Details
gjs-listbox.js (538 bytes, application/javascript)
2017-03-31 11:31 UTC, Felipe Borges
  Details
flowbox.vala (678 bytes, text/x-vala)
2017-03-31 11:31 UTC, Felipe Borges
  Details
flowbox: Fix annotation for GListModel binding callback (1.28 KB, patch)
2017-09-25 14:59 UTC, Sam Thursfield
committed Details | Review

Description Felipe Borges 2017-03-31 11:29:07 UTC
Created attachment 349039 [details]
gjs-flowbox.js

While trying to bind a GListStore to a GtkFlowBox I am getting the following errors:

for Gjs

(gjs:15347): GLib-GObject-CRITICAL **: g_object_is_floating: assertion 'G_IS_OBJECT (object)' failed

(gjs:15347): Gtk-CRITICAL **: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' failed

(gjs:15347): Gtk-CRITICAL **: gtk_flow_box_insert: assertion 'GTK_IS_WIDGET (widget)' failed

(gjs:15347): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

for Python

AttributeError: 'int' object has no attribute 'get_label'
test.py:21: Warning: g_object_is_floating: assertion 'G_IS_OBJECT (object)' failed
  model.append (item1)

(test.py:15457): Gtk-CRITICAL **: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' failed

(test.py:15457): Gtk-CRITICAL **: gtk_flow_box_insert: assertion 'GTK_IS_WIDGET (widget)' failed
test.py:21: Warning: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
  model.append (item1)

Notice that the $item pointer passed to the GtkFlowBoxCreateWidgetFunc is an int in python (probably an address).
Comment 1 Felipe Borges 2017-03-31 11:29:32 UTC
Created attachment 349040 [details]
python-flowbox.py
Comment 2 Felipe Borges 2017-03-31 11:31:02 UTC
Created attachment 349041 [details]
gjs-listbox.js

It works just fine with Gtk.ListBox using exactly the same code, just s/FlowBox/ListBox/g
Comment 3 Felipe Borges 2017-03-31 11:31:56 UTC
Created attachment 349042 [details]
flowbox.vala

Curiously it works just fine with Vala.
Comment 4 Sam Thursfield 2017-09-25 14:58:04 UTC
This issue seems to be due to missing annotations on the callback type. Patch incoming.
Comment 5 Sam Thursfield 2017-09-25 14:59:09 UTC
Created attachment 360362 [details] [review]
flowbox: Fix annotation for GListModel binding callback

The GtkFlowBoxCreateWidgetFunc type lacked GObject Introspection
annotations for its arguments. This made gtk_flow_box_bind_model()
unusable from Python as the callback function would be passed useless
values.

The annotations that I've added match those of the similar callback
type GtkListBoxCreateWidgetFunc.
Comment 6 Felipe Borges 2017-09-27 10:00:17 UTC
Review of attachment 360362 [details] [review]:

Thanks. It works for me now.

I will let a gtk+ maintainer weight on it.
Comment 7 Rico Tzschichholz 2017-09-27 11:42:48 UTC
Attachment 360362 [details] pushed as c9df0c3 - flowbox: Fix annotation for GListModel binding callback