From af26a18032b298b7c4d1e592f97e2e7949190de6 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 9 Jul 2013 18:08:21 +0100 Subject: [PATCH] wayland: Handle the display connection erroring out wl_display_flush or wl_display_dispatch can return -1 if there is an error on the display connection. https://bugzilla.gnome.org/show_bug.cgi?id=703892 --- gdk/wayland/gdkeventsource.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gdk/wayland/gdkeventsource.c b/gdk/wayland/gdkeventsource.c index 4bcae9b285..619ee872c1 100644 --- a/gdk/wayland/gdkeventsource.c +++ b/gdk/wayland/gdkeventsource.c @@ -20,6 +20,8 @@ #include "gdkinternals.h" #include "gdkprivate-wayland.h" +#include + typedef struct _GdkWaylandEventSource { GSource source; GPollFD pfd; @@ -47,7 +49,8 @@ gdk_event_source_prepare(GSource *base, gint *timeout) if (_gdk_event_queue_find_first (source->display) != NULL) return TRUE; - wl_display_flush(display->wl_display); + if (wl_display_flush (display->wl_display) < 0) + g_error ("Error dispatching display: %s", g_strerror (errno)); return FALSE; } @@ -152,7 +155,10 @@ _gdk_wayland_display_queue_events (GdkDisplay *display) source = (GdkWaylandEventSource *) display_wayland->event_source; if (source->pfd.revents & G_IO_IN) - wl_display_dispatch (display_wayland->wl_display); + { + if (wl_display_dispatch (display_wayland->wl_display) < 0) + g_error ("Error dispatching display: %s", g_strerror (errno)); + } if (source->pfd.revents & (G_IO_ERR | G_IO_HUP)) g_error ("Lost connection to wayland compositor");