compositor: Wrap XDamageCreate call with error trap

I hit this rare error running the "x11" test from the suite locally:

(mutter:194027): Gdk-ERROR **: 18:21:52.525: The program 'mutter' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadDrawable (invalid Pixmap or Window parameter)'.
  (Details: serial 663 error_code 9 request_code 143 (DAMAGE) minor_code 1)
  (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.)

The only call from the Damage extension in use by Mutter that could
return BadDrawable is XDamageCreate(), and it's likely to be this
call. Wrap this X11 in an error trap, in order to catch possible
failures.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2793>
This commit is contained in:
Carlos Garnacho 2023-01-18 22:15:45 +01:00 committed by Marge Bot
parent 57ce4e04e5
commit 2be5662ee9

View File

@ -347,10 +347,13 @@ meta_surface_actor_x11_init (MetaSurfaceActorX11 *self)
static void
create_damage (MetaSurfaceActorX11 *self)
{
Display *xdisplay = meta_x11_display_get_xdisplay (self->display->x11_display);
MetaX11Display *x11_display = meta_display_get_x11_display (self->display);
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (self->window);
meta_x11_error_trap_push (x11_display);
self->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
meta_x11_error_trap_pop (x11_display);
}
static void