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
This commit is contained in:
Olivier Fourdan 2015-02-27 13:06:29 +01:00 committed by Matthias Clasen
parent ff85f6ce3f
commit 53028ff3bb

View File

@ -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;
}