Skip to content

Commit

Permalink
main: Don't have to call SDL_WasInit, subsystem init is reference-cou…
Browse files Browse the repository at this point in the history
…nted.
  • Loading branch information
icculus committed Nov 1, 2023
1 parent a4c3fe4 commit efd38e5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main/SDL_main_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ int SDL_InitMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit, SDL_
const int rc = appinit(argc, argv);
if (SDL_AtomicCAS(&apprc, 0, rc) && (rc == 0)) { // bounce if SDL_AppInit already said abort, otherwise...
// make sure we definitely have events initialized, even if the app didn't do it.
if (!SDL_WasInit(SDL_INIT_EVENTS)) {
if (SDL_Init(SDL_INIT_EVENTS) == -1) {
SDL_AtomicSet(&apprc, -1);
return -1;
}
if (SDL_Init(SDL_INIT_EVENTS) == -1) {
SDL_AtomicSet(&apprc, -1);
return -1;
}

// drain any initial events that might have arrived before we added a watcher.
Expand Down

0 comments on commit efd38e5

Please sign in to comment.