From 707e542f9a427c3b51ec77d47b1fbc26c663a60f Mon Sep 17 00:00:00 2001
From: Kevin Locke <kevin@kevinlocke.name>
Date: Sat, 28 Nov 2020 21:17:09 -0700
Subject: [PATCH] eglut_wayland: exit event loop on POLLNVAL

If the file descriptor becomes invalid (e.g. because
wl_display_disconnect has been called) exit the event loop.  There's no
value from continuing to poll.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
---
 src/egl/eglut/eglut_wayland.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/eglut/eglut_wayland.c b/src/egl/eglut/eglut_wayland.c
index 578ade1c2..2c02df9e2 100644
--- a/src/egl/eglut/eglut_wayland.c
+++ b/src/egl/eglut/eglut_wayland.c
@@ -222,7 +222,7 @@ _eglutNativeEventLoop(void)
       if (poll(&pollfd, 1, -1) == -1)
          break;
 
-      if (pollfd.revents & (POLLERR | POLLHUP))
+      if (pollfd.revents & (POLLERR | POLLHUP | POLLNVAL))
          break;
 
       if (pollfd.events & POLLOUT) {
-- 
GitLab