GNOME Bugzilla – Bug 789242
Gnome-shell aborts with X error BadWindow if a window is created and quickly destroyed
Last modified: 2017-10-20 12:18:13 UTC
Created attachment 361933 [details] A simplified reproducer. This problem was originally reported downstream here: https://bugzilla.opensuse.org/show_bug.cgi?id=1062904 Starting `qemu-system-x86_64 -display sdl` crashes gnome-shell. It can be also reproduced with a simplified program (attached). It was observed in version 3.26.1, not sure about newer ones, but there is no obvious fix in git log. Gnome-shell terminates with error: The program 'gnome-shell' received an X Window System error. This probably reflects a bug in the program. The error was 'BadWindow (invalid Window parameter)'. (Details: serial 9274 error_code 3 request_code 18 (core protocol) minor_code 0) (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 GDK_SYNCHRONIZE environment variable to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.) If you run gnome-shell with GDK_SYNCHRONIZE set, it does not crash. (It is most likely timing sensitive, see later.) The request_code 18 is ChangeProperty request. I have recorded the X11 communication and observed this happening: * qemu creates window * gnome-shell queries and sets various properties on it * qemu destroys window * gnome-shell attempts to set two properties: * _NET_WM_STATE = _NET_WM_STATE_FOCUSED * _GTK_EDGE_CONSTRAINTS = 0xaa * gnome-shell receives BadWindow error and aborts I think that the race between setting window properties and window being destroyed by another application is unavoidable. Gnome-shell should handle the BadWindow error gracefully instead of aborting. For example kwin reacts to the same situation by printing error to log and continuing.
*** This bug has been marked as a duplicate of bug 788666 ***