From 019468dc59ebb810ad705fc96577e210fe0c7657 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sat, 4 Nov 2023 09:31:07 -0400
Subject: [PATCH] main: Check for SDL_AddEventWatch failure, now that it can
report it.
---
src/main/SDL_main_callbacks.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/main/SDL_main_callbacks.c b/src/main/SDL_main_callbacks.c
index 2ac9abaf8f5a..076c842597ba 100644
--- a/src/main/SDL_main_callbacks.c
+++ b/src/main/SDL_main_callbacks.c
@@ -67,7 +67,11 @@ int SDL_InitMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit, SDL_
total_pending_events++;
}
- SDL_AddEventWatch(EventWatcher, NULL); // !!! FIXME: this should really return an error.
+ if (SDL_AddEventWatch(EventWatcher, NULL) == -1) {
+ SDL_free(pending_events);
+ SDL_AtomicSet(&apprc, -1);
+ return -1;
+ }
for (int i = 0; i < total_pending_events; i++) {
SDL_PushEvent(&pending_events[i]);