GTK+2: gdk_pointer_grab() gdk_check_xpending() and gdk_display_pointer_ungrab() crash with unplugged device
On GIMP: https://bugzilla.gnome.org/show_bug.cgi?id=795635 This is similar to this old bug: https://bugzilla.gnome.org/show_bug.cgi?id=575767 Basically with GTK+2, there is no hotplug yet, and in particular unplugging an input device (e.g. a graphics tablet) may generate X11 errors on later calls.
Attached is a patch similar to the old commit which was already done years ago. As we are not going to implement hotplugging on GTK+2 and that GTK+3 will just fix this all, can I just push this? 0001-Bug-795635-crash-from-unplugging-the-tablet-while-GI.patch
Steps to reproduce
- Make sure the tablet is plugged in, and start GIMP.
- Make a new file.
- Unplug the Wacom tablet. GIMP hasn't crashed yet.
- Put the mouse over the GIMP image window. GIMP hasn't crashed yet.
- Press the space key on the keyboard. GIMP crashes immediately with this terminal output:
This probably reflects a bug in the program. The error was 'XI_BadDevice (invalid Device parameter)'. (Details: serial 333968 error_code 129 request_code 131 minor_code 13) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.)
(script-fu:12593): LibGimpBase-WARNING **: 12:09:07.490: script-fu: gimp_wire_read(): error
Version information
- GTK+ 2 using HEAD of branch "gtk-2-24"
- OS: Fedora (any X11 Linux should have the bug)