main: SDL_AppQuit() now reports the result value.

Fixes #10994.
This commit is contained in:
Ryan C. Gordon
2024-09-29 22:17:11 -04:00
parent 6a7f8b74f1
commit 1787d6ca5c
37 changed files with 48 additions and 42 deletions

View File

@@ -28,7 +28,7 @@ static void EmscriptenInternalMainloop(void)
{
const SDL_AppResult rc = SDL_IterateMainCallbacks(true);
if (rc != SDL_APP_CONTINUE) {
SDL_QuitMainCallbacks();
SDL_QuitMainCallbacks(rc);
emscripten_cancel_main_loop(); // kill" the mainloop, so it stops calling back into it.
exit((rc == SDL_APP_FAILURE) ? 1 : 0); // hopefully this takes down everything else, too.
}
@@ -40,7 +40,7 @@ int SDL_EnterAppMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit,
if (rc == SDL_APP_CONTINUE) {
emscripten_set_main_loop(EmscriptenInternalMainloop, 0, 0); // run at refresh rate, don't throw an exception since we do an orderly return.
} else {
SDL_QuitMainCallbacks();
SDL_QuitMainCallbacks(rc);
}
return (rc == SDL_APP_FAILURE) ? 1 : 0;
}