Skip to content

Commit

Permalink
Make sure that we quit if we get a terminating event
Browse files Browse the repository at this point in the history
This covers the case where the application didn't handle the quit or terminating event, we still need the main loop to finish.
  • Loading branch information
slouken committed Oct 18, 2024
1 parent c5e1ae4 commit a432abf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/SDL_main_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ static bool SDLCALL SDL_MainCallbackEventWatcher(void *userdata, SDL_Event *even
// Make sure any currently queued events are processed then dispatch this before continuing
SDL_DispatchMainCallbackEvents();
SDL_DispatchMainCallbackEvent(event);

// Make sure that we quit if we get a terminating event
if (event->type == SDL_EVENT_TERMINATING) {
SDL_CompareAndSwapAtomicInt(&apprc, SDL_APP_CONTINUE, SDL_APP_SUCCESS);
}
} else {
// We'll process this event later from the main event queue
}
Expand Down

0 comments on commit a432abf

Please sign in to comment.