Abort if addWatch during initialization of poll data fails
This commit is contained in:
parent
6d96a89328
commit
a41ef8d513
7
glfw/backend_utils.c
vendored
7
glfw/backend_utils.c
vendored
@ -229,15 +229,16 @@ drain_wakeup_fd(int fd, int events UNUSED, void* data UNUSED) {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
initPollData(EventLoopData *eld, int display_fd) {
|
initPollData(EventLoopData *eld, int display_fd) {
|
||||||
addWatch(eld, "display", display_fd, POLLIN, 1, NULL, NULL);
|
if (!addWatch(eld, "display", display_fd, POLLIN, 1, NULL, NULL)) return false;
|
||||||
#ifdef HAS_EVENT_FD
|
#ifdef HAS_EVENT_FD
|
||||||
eld->wakeupFd = eventfd(0, 0);
|
eld->wakeupFd = eventfd(0, 0);
|
||||||
if (eld->wakeupFd == -1) return false;
|
if (eld->wakeupFd == -1) return false;
|
||||||
addWatch(eld, "wakeup", eld->wakeupFd, POLLIN, 1, drain_wakeup_fd, NULL);
|
const int wakeup_fd = eld->wakeupFd;
|
||||||
#else
|
#else
|
||||||
if (pipe2(eld->wakeupFds, O_CLOEXEC | O_NONBLOCK) != 0) return false;
|
if (pipe2(eld->wakeupFds, O_CLOEXEC | O_NONBLOCK) != 0) return false;
|
||||||
addWatch(eld, "wakeup", eld->wakeupFds[0], POLLIN, 1, drain_wakeup_fd, NULL);
|
const int wakeup_fd = eld->wakeupFds[0];
|
||||||
#endif
|
#endif
|
||||||
|
if (!addWatch(eld, "wakeup", wakeup_fd, POLLIN, 1, drain_wakeup_fd, NULL)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user