GNOME Bugzilla – Bug 756109
Fix marshalling of user data arguments to callback
Last modified: 2015-10-10 22:12:04 UTC
When the callback is marshalled, it will put something in the arg cache. Make sure we recognize it before the closure detection code overwrites it with the C gpointer closure arg. Fixes GLib.idle_add(lambda x: False, None) in pygobject 3.18 and master.
Created attachment 312711 [details] [review] Fix marshalling of user data arguments to callback
*** Bug 756087 has been marked as a duplicate of this bug. ***
Could you add some info on why this worked before and what broke/changed it?
I have no idea to be honest :) I only sporadically use pygobject apps. I was testing gnome-news yesterday and I found that it would fail to load, claiming that GLib.idle_add (aka g_idle_add_full) only takes 2 arguments, not 3. Further gdb'ing revealed that the arg cache code fails to recognize the user_data varying argument (the index is -1 when the invoke code runs), and this patch is my guess for why that happens. As for what changed in the particular case, someone added (closure) to the user_data argument in glib some time this cycle (or maybe after 3.18?), which means that get_closure() on that argument returns the argument number (as espected). Before it would return -1 (and it would return the closure number when called on the callback argument).
(In reply to Giovanni Campagna from comment #4) > As for what changed in the particular case, someone added (closure) to the > user_data argument in glib some time this cycle (or maybe after 3.18?), > which means that get_closure() on that argument returns the argument number > (as espected). Before it would return -1 (and it would return the closure > number when called on the callback argument). Hm, why is that expected? get_closure is documented to return the user_data index for callbacks afaics, or am I missing something? Filed bug 756352 in gi