From 2be5662ee90e7d3ea75f507d8ca63144d557cd3d Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 18 Jan 2023 22:15:45 +0100 Subject: [PATCH] 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: --- src/compositor/meta-surface-actor-x11.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c index 004010054..df19a5c22 100644 --- a/src/compositor/meta-surface-actor-x11.c +++ b/src/compositor/meta-surface-actor-x11.c @@ -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