GNOME Bugzilla – Bug 647581
Flags do not seem to work on signal handlers
Last modified: 2011-08-13 10:14:13 UTC
I am attaching a small program so you can see it by yourself.
Created attachment 185799 [details] test.py main program
Created attachment 185800 [details] accelmap.ui ui file
You just have to do python test.py and then intro in the accel to be edited and then try to press i.e control+M, M is entered but control is not detected, it is always passed 0 to the handler.
*** Bug 649630 has been marked as a duplicate of this bug. ***
Created attachment 187724 [details] [review] Handle arguments that are flags The attached patch should fix this issue, could you please check.
Well, the patch looks good to me although I'm getting a crash in the invoke-rewrote branch and not sure if it really fixes the problem
I'll take a look on the invoke-rewrite branch today
What crash are you seeing? It works fine for me with this patch.
BTW is there a way we can have a unit test for this?
Here is the bt. See that I'm using a plugin not exactly the code attached in this bug report. So probably it is another issue Program received signal SIGSEGV, Segmentation fault. 0x00007fffe60b104b in pygi_marshal_cleanup_args_in_parameter_fail (state= 0x7fffffffb040, cache=0x16934c0, failed_arg_index=4294967295) at pygi-marshal-cleanup.c:141 141 gpointer data = state->args[i]->v_pointer; (gdb) bt
+ Trace 227669
Ok, it failed while processing one of the args and is iterating over the processed args to free them. It looks like it is most likely going past the bounds of the state->args array. Ah, i must be -1 :-) Didn't cover that edge case.
So I don get it, failed_arg_index=4294967295 which I am guessing is 0 - 1 if it were unsigned but i is an int and failed_arg_index is a gssize, both of which are signed values. i most likely should also be gssize.
Ok, so the compiler most likely doesn't cast the int to the larger gssize. Please check out the latest which contains this bug's patch. I made it so all arg indexes use gssize instead of int or gsize. We still use gsize for arrays but if a parameter list is greater than the max of gssize that API has issues.
Seems to not crash now, although now I am getting this other problem :( Traceback (most recent call last):
+ Trace 227691
Gtk.AccelMap.foreach(None, self.populate_treeview)
return info.invoke(*args)
The first parameter of foreach is not marked allow none.
dunno, see that it is data, and it was working in pygobject 2.28
It works in pygobject 2.28 because they were lax with testing for allow none. invoke-rewrite is much stricter (and safer in that regard). If introspection wants to assume that data allows none it should mark it as such. Can you annotate Gtk+ and tell me if it works? If it does, feel free to just commit it.
Works perfect thanks. Pushed to gtk-3-0 and master.