diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2021-11-17 11:14:00 +0100 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2021-11-17 11:14:00 +0100 |
commit | 102341ae9f53dad735b2e637892bef3b57361b39 (patch) | |
tree | 8e42e39f71b1ab033e9b8f9419e502be4f102734 | |
parent | 2d67c74ea2a6bf25bd5d12814579ce20fa981fd1 (diff) | |
download | gtk+-102341ae9f53dad735b2e637892bef3b57361b39.tar.gz |
x11: Trap error when getting CRTC info
This should fix a race happening when RANDR changes quickly, e.g. during
unit testing where tests change monitor configurations rapidly.
-rw-r--r-- | gdk/x11/gdkscreen-x11.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index bb4df059bc..81499ba106 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -568,9 +568,18 @@ init_randr15 (GdkScreen *screen, gboolean *changed) if (output_info->crtc) { - XRRCrtcInfo *crtc = XRRGetCrtcInfo (x11_screen->xdisplay, resources, output_info->crtc); + XRRCrtcInfo *crtc; int j; + gdk_x11_display_error_trap_push (display); + crtc = XRRGetCrtcInfo (x11_screen->xdisplay, resources, + output_info->crtc); + if (gdk_x11_display_error_trap_pop (display)) + { + XRRFreeOutputInfo (output_info); + continue; + } + for (j = 0; j < resources->nmode; j++) { XRRModeInfo *xmode = &resources->modes[j]; |