GNOME Bugzilla – Bug 661673
gedit / External Tools - cannot change language of tools
Last modified: 2011-10-25 14:33:37 UTC
A user cannot constrain a tool to a language. Upon attempting to select a language, the pop-up is shown, however none can be selected. Output to the terminal is Traceback (most recent call last):
+ Trace 228786
return self.propagate_mouse_event(event)
if widget.event(event):
return info.invoke(*args, **kwargs)
I think this is a pygobject problem as it was working with 2.28.
I need a simple test case to debug this.
Created attachment 199134 [details] test.py As commanded, the test case ;)
Created attachment 199327 [details] [review] Do union member checks for unions that are parameters * before we were only doing checks if the union was an instance
This is the fix. I'm trying to get the event tests working again but the gtk test methods for simulating key presses and button clicks don't work for some reason which is why we missed this. I spend a bit debugging what turned out to be a red herring in the test case that was posted here. At some point all objects were returing NULL for their attribute dictionary. Turns out it was just a recursion limit hit by the call to self.event(event) so I now propagate any exceptions encountered when calling _is_union_memeber. enjoy
tests don't work because we need to call gtk_test_init but that would require a static helper library since gtk_test_init takes varargs. punting tests for now. need to think of a better way of handling this.
Works perfect in gedit.
Created attachment 199531 [details] simple tree test case i think im seeing the same bug as this, ill attack a simple test case too, this is with the latest git compiled after commit http://git.gnome.org/browse/pygobject/commit/?id=585222915dc98b0e375de3db4771466278a32e81 ill attach a simple test case
> print event #prints <void at 0x22746a0> this should be Gdk.Event surely? under gtk2 was gtk.gdk.Event void is correct, you are getting the structure Gdk.MotionEvent. All structs are void typed because they don't have a type in the GObject type system. In reality the union's pointer is the same as the actual stuct member but it is really complicated to represent this in pygobject since they don't really derive from each other. Parent type information is lost when accessing event.motion_event. At some point we may wish to keep a parent pointer back to the enum but that is dangerous in itself. First we aren't even sure if the structure came from an enum as it could have been created explicitly and second if the user has access to the raw event they can easily deref a NULL pointer by accessing a structure that is larger than the intended event type. If you are trying to check the type of the event please use event.type instead of trying to directly compare the event itself. Personally I would have liked to special case Events but that is not easily done because it would add a dependency on Gdk/Gtk which we explicitly try to avoid.
and by enum I of course meant union
ah ok, i see, so its a GObject.TYPE_NONE now instead of a Gdk.Event, thanks for clearing that up