main: Check for SDL_AddEventWatch failure, now that it can report it.

main
Ryan C. Gordon 2023-11-04 09:31:07 -04:00
parent 7e445da569
commit 019468dc59
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 5 additions and 1 deletions

View File

@ -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]);