events: Fix spurious early returns from SDL_WaitEvent()/SDL_WaitEventTimeout()

Fixes #5780
This commit is contained in:
Cameron Gutman 2022-06-11 12:59:33 -05:00 committed by Sam Lantinga
parent b3260e7eb3
commit 81d3adddbf
1 changed files with 4 additions and 1 deletions

View File

@ -973,7 +973,10 @@ SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Event * event,
status = _this->WaitEventTimeout(_this, loop_timeout); status = _this->WaitEventTimeout(_this, loop_timeout);
/* Set wakeup_window to NULL without holding the lock. */ /* Set wakeup_window to NULL without holding the lock. */
_this->wakeup_window = NULL; _this->wakeup_window = NULL;
if (status <= 0) { if (status == 0 && need_periodic_poll && loop_timeout == PERIODIC_POLL_INTERVAL_MS) {
/* We may have woken up to poll. Try again */
continue;
} else if (status <= 0) {
/* There is either an error or the timeout is elapsed: return */ /* There is either an error or the timeout is elapsed: return */
return status; return status;
} }