GNOME Bugzilla – Bug 597292
handling of flags types with unknown flags
Last modified: 2011-06-14 20:05:10 UTC
Sometimes alt-tab stops working and I get the errors below in the terminal. The popup works and I can change between the two most recent (I think) windows, but subsequent tab'ing produces the error. The error will also seemingly randomly dissappear and reappear. System is Ubuntu 9.10 beta updated as of 4.10.2009. gnome-shell is of the git-repository pulled the same date (donno how to get more specific version-info) built using 'jhbuild build'. JS ERROR: !!! Exception was: Error: 0x2018 is not a valid value for flags GdkModifierType JS ERROR: !!! lineNumber = '0' JS ERROR: !!! fileName = 'gjs_throw' JS ERROR: !!! message = '0x2018 is not a valid value for flags GdkModifierType' JS ERROR: !!! stack = 'Error("0x2018 is not a valid value for flags GdkModifierType")@:0 ("0x2018 is not a valid value for flags GdkModifierType")@gjs_throw:0 @:0 (1)@/home/bh/gnome-shell/source/gnome-shell/js/ui/altTab.js:148 ([object _private_Shell_WM],"switch_windows",null,false)@/home/bh/gnome-shell/source/gnome-shell/js/ui/windowManager.js:277 ([object _private_Shell_WM],"switch_windows",null,false)@/home/bh/gnome-shell/install/share/gjs-1.0/lang.js:110 Error("Chained exception")@:0 ("Chained exception")@gjs_throw:0 '
git-version is 9b05304c2d58b8fc5f5e75c6a2ac2ec4523d4565
JS ERROR: !!! Exception was: Error: 0x2018 is not a valid value for flags GdkModifierType of course, GdkModifierType is just a wrapper around a set of X defines, and sometimes contains bits that don't have names in the GdkModifierType enum. I think this has to be considered a gjs bug? (gdktypes.h suggests that 0x2000 is something XKB-related. So if this only happens sometimes, it may have to do with either (a) which keyboard layout you're using at the time, or (b) whether the currently-selected app supports XKB natively or is using the fallback to core X keyboard support.) We can work around this in 2.28.0 by just writing a C function to check the modifier state for us.
not sure what we'd do here. maybe introspection should have an annotation like "flags can have arbitrary value, do not validate" ?
Hm. I was going to say that there's no need to validate values coming *from* C, but I guess if you still validated values going *to* C then you'd end up with situations where something like: foo.set_flags(foo.get_flags() | PERFECTLY_LEGITIMATE_VALUE); could fail What Would PyGtk Do?
Briefly scanned your comments and I can confirm that I am alternating between two keyboard layouts at "run time", Danish and UK.
I guess just never validating at all is an option, the tradeoff is there's more ability to crash C code from JS Don't know if it's worth a special-case in introspection or not to preserve that
Just a brief comment to tell you that sticking to only one layout (only tried UK) seems to avoid the problem.
(In reply to comment #4) > What Would PyGtk Do? it appears to just strip them out. eg: >>> gtk.gdk.display_get_default().get_pointer() (<gtk.gdk.ScreenX11 object at 0x7f9d030100f0 (GdkScreenX11 at 0xa0e180)>, 245, 769, <flags GDK_MOD2_MASK of type GdkModifierType>) while xev shows: KeyPress event, serial 30, synthetic NO, window 0x4000001, root 0x100, subw 0x0, time 148402192, (82,155), root:(86,203), state 0x2010, keycode 38 (keysym 0x71, q), same_screen YES, ^^^^^^
oh btw, bug 597559 filed with workaround for gnome-shell. Bjørn, could you test that?
that's kinda evil... I mean, in theory the keyboard group flag is useful. Maybe the real bug here is in GDK for not defining an enum value for that flag bit?
git bz fail
https://bugzilla.gnome.org/show_bug.cgi?id=634994
So a data point is that pygtk appears to have changed in the last year, I now get: KeyPress event, serial 33, synthetic NO, window 0x5600001, root 0x126, subw 0x0, time 6277267, (630,638), root:(634,687), state 0x4000, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False (<gtk.gdk.ScreenX11 object at 0x1a3b0f0 (GdkScreenX11 at 0x1abd7d0)>, 628, 711, <flags 16384 of type GdkModifierType>)
Clutter fix: https://bugzilla.gnome.org/show_bug.cgi?id=650329
This should be fixed now.