summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2013-09-19 17:32:22 +0200
committerAlexander Preisinger <alexander.preisinger@gmail.com>2013-09-19 17:45:49 +0200
commit858dcee5f102fc7273e4ab1665e5230929a3c958 (patch)
tree456261b7086f7aac572fc5fa6237c280a7ebfb6e /video
parent6599677b98a00dac2a2650c1bb6a9cb77a2779f4 (diff)
downloadmpv-858dcee5f102fc7273e4ab1665e5230929a3c958.tar.bz2
mpv-858dcee5f102fc7273e4ab1665e5230929a3c958.tar.xz
wayland/common: exit properly on fd errors
Before this commit there was just an error message, but the file descriptor was still open. Now we close the file descriptor and prevent it from calling endlessly. Also a CLOSE_WIN event is sent which closes the window eventually if the action of CLOSE_WIN is set to quit or quit_watch_later.
Diffstat (limited to 'video')
-rw-r--r--video/out/wayland_common.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 533b8c056d..109e2dc4b0 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -805,8 +805,12 @@ static int vo_wayland_check_events (struct vo *vo)
* when pausing no input events get queued so we have to check if there
* are events to read from the file descriptor through poll */
if (poll(&fd, 1, 0) > 0) {
- if (fd.revents & POLLERR || fd.revents & POLLHUP)
- MP_ERR(wl, "error occurred on the display fd\n");
+ if (fd.revents & POLLERR || fd.revents & POLLHUP) {
+ MP_FATAL(wl, "error occurred on the display fd: "
+ "closing file descriptor\n");
+ close(wl->display.display_fd);
+ mp_input_put_key(vo->input_ctx, MP_KEY_CLOSE_WIN);
+ }
if (fd.revents & POLLIN)
wl_display_dispatch(dp);
if (fd.revents & POLLOUT)