mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 00:07:33 +00:00
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.
This commit is contained in:
parent
6599677b98
commit
858dcee5f1
@ -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
|
* when pausing no input events get queued so we have to check if there
|
||||||
* are events to read from the file descriptor through poll */
|
* are events to read from the file descriptor through poll */
|
||||||
if (poll(&fd, 1, 0) > 0) {
|
if (poll(&fd, 1, 0) > 0) {
|
||||||
if (fd.revents & POLLERR || fd.revents & POLLHUP)
|
if (fd.revents & POLLERR || fd.revents & POLLHUP) {
|
||||||
MP_ERR(wl, "error occurred on the display fd\n");
|
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)
|
if (fd.revents & POLLIN)
|
||||||
wl_display_dispatch(dp);
|
wl_display_dispatch(dp);
|
||||||
if (fd.revents & POLLOUT)
|
if (fd.revents & POLLOUT)
|
||||||
|
Loading…
Reference in New Issue
Block a user