[gtk+] wayland: Handle the display connection erroring out



commit af26a18032b298b7c4d1e592f97e2e7949190de6
Author: Rob Bradford <rob linux intel com>
Date:   Tue Jul 9 18:08:21 2013 +0100

    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 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gdk/wayland/gdkeventsource.c b/gdk/wayland/gdkeventsource.c
index 4bcae9b..619ee87 100644
--- a/gdk/wayland/gdkeventsource.c
+++ b/gdk/wayland/gdkeventsource.c
@@ -20,6 +20,8 @@
 #include "gdkinternals.h"
 #include "gdkprivate-wayland.h"
 
+#include <errno.h>
+
 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");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]