[gtk+] wayland: Don't use g_error() on connection lost



commit 53028ff3bb0610f5fb4df360391af9ee23f61cfa
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Fri Feb 27 13:06:29 2015 +0100

    wayland: Don't use g_error() on connection lost
    
    When the Wayland compositor vanishes, all applications connected will
    receive a SIGPIPE as soon as they try to use wl_display_dispatch().
    
    Do not use g_error() to terminate the applications when this occurs,
    g_error() means an error in the application while here it's not truly
    the case.
    
    Use g_warning() and exit() instead.
    
    Signed-off-by: Olivier Fourdan <ofourdan redhat com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745289

 gdk/wayland/gdkeventsource.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/gdk/wayland/gdkeventsource.c b/gdk/wayland/gdkeventsource.c
index 1595a30..d675ce9 100644
--- a/gdk/wayland/gdkeventsource.c
+++ b/gdk/wayland/gdkeventsource.c
@@ -20,6 +20,7 @@
 #include "gdkinternals.h"
 #include "gdkprivate-wayland.h"
 
+#include <stdlib.h>
 #include <errno.h>
 
 typedef struct _GdkWaylandEventSource {
@@ -160,11 +161,17 @@ _gdk_wayland_display_queue_events (GdkDisplay *display)
   if (source->pfd.revents & G_IO_IN)
     {
       if (wl_display_dispatch (display_wayland->wl_display) < 0)
-        g_error ("Error dispatching display: %s", g_strerror (errno));
+        {
+          g_warning ("Error %d (%s) dispatching to Wayland display.",
+                     errno, g_strerror (errno));
+          exit (1);
+        }
     }
 
   if (source->pfd.revents & (G_IO_ERR | G_IO_HUP))
-    g_error ("Lost connection to wayland compositor");
-
+    {
+      g_warning ("Lost connection to Wayland compositor.");
+      exit (1);
+    }
   source->pfd.revents = 0;
 }


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