summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2013-07-09 18:59:11 -0400
committerKristian Høgsberg <krh@bitplanet.net>2013-07-09 18:59:11 -0400
commit93d888aec6331ce30e61188cc00ab3dc9f137efb (patch)
treee352478b0969303fd023332a81a5fb35d3bfd88e
parentbecca5fcf7a69e5e7b2d287a8a24d93d9d29fa5a (diff)
wayland-server: Don't close display fd in fatal error handler
We can't do that there, we have to make sure it stays a valid fd until the application calls wl_display_disconnect(). Otherwise the application may end up poll()ing on a stale or wrong fd in case another part of the application (or another thread) triggered a fatal error.
-rw-r--r--src/wayland-client.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 7bd7f0d..34c8196 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -107,8 +107,6 @@ display_fatal_error(struct wl_display *display, int error)
error = 1;
display->last_error = error;
- close(display->fd);
- display->fd = -1;
wl_list_for_each(iter, &display->event_queue_list, link)
pthread_cond_broadcast(&iter->cond);
@@ -612,8 +610,7 @@ wl_display_disconnect(struct wl_display *display)
wl_event_queue_release(&display->queue);
pthread_mutex_destroy(&display->mutex);
pthread_cond_destroy(&display->reader_cond);
- if (display->fd > 0)
- close(display->fd);
+ close(display->fd);
free(display);
}