From 051f3838de9959087bc0a0ba76d3737588a1f67f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 26 Mar 2014 13:28:27 -0700 Subject: [PATCH] client: Delay EPIPE handling so we get a chance to handle error events --- src/wayland-client.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wayland-client.c b/src/wayland-client.c index 2dbb295f..bd403136 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -44,7 +44,6 @@ #include "wayland-client.h" #include "wayland-private.h" - /** \cond */ enum wl_proxy_flag { @@ -1318,8 +1317,12 @@ wl_display_dispatch_queue(struct wl_display *display, return ret; } + /* We ignore EPIPE here, so that we try to read events before + * returning an error. When the compositor sends an error it + * will close the socket, and if we bail out here we don't get + * a chance to process the error. */ ret = wl_connection_flush(display->connection); - if (ret < 0 && errno != EAGAIN) { + if (ret < 0 && errno != EAGAIN && errno != EPIPE) { display_fatal_error(display, errno); goto err_unlock; }