From 1787d6ca5c249c7ebabf885e63c96b1a5f3f61cc Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sun, 29 Sep 2024 22:17:11 -0400
Subject: [PATCH] main: SDL_AppQuit() now reports the result value.
Fixes #10994.
---
docs/README-main-functions.md | 5 ++++-
examples/audio/01-simple-playback/simple-playback.c | 2 +-
.../simple-playback-callback.c | 2 +-
examples/audio/03-load-wav/load-wav.c | 2 +-
examples/camera/01-read-and-draw/read-and-draw.c | 2 +-
examples/game/01-snake/snake.c | 2 +-
examples/pen/01-drawing-lines/drawing-lines.c | 2 +-
examples/renderer/01-clear/clear.c | 2 +-
examples/renderer/02-primitives/primitives.c | 2 +-
examples/renderer/03-lines/lines.c | 2 +-
examples/renderer/04-points/points.c | 2 +-
examples/renderer/05-rectangles/rectangles.c | 2 +-
examples/renderer/06-textures/textures.c | 2 +-
.../07-streaming-textures/streaming-textures.c | 2 +-
.../renderer/08-rotating-textures/rotating-textures.c | 2 +-
.../renderer/09-scaling-textures/scaling-textures.c | 2 +-
examples/renderer/10-geometry/geometry.c | 2 +-
examples/renderer/11-color-mods/color-mods.c | 2 +-
examples/renderer/14-viewport/viewport.c | 2 +-
examples/renderer/15-cliprect/cliprect.c | 2 +-
examples/renderer/17-read-pixels/read-pixels.c | 2 +-
examples/template.c | 2 +-
include/SDL3/SDL_init.h | 2 +-
include/SDL3/SDL_main.h | 3 ++-
src/main/SDL_main_callbacks.c | 4 ++--
src/main/SDL_main_callbacks.h | 2 +-
src/main/emscripten/SDL_sysmain_callbacks.c | 4 ++--
src/main/generic/SDL_sysmain_callbacks.c | 2 +-
src/main/ios/SDL_sysmain_callbacks.m | 10 ++++++----
test/loopwave.c | 2 +-
test/testaudio.c | 2 +-
test/testaudiorecording.c | 2 +-
test/testcamera.c | 2 +-
test/testdropfile.c | 2 +-
test/testgpu_simple_clear.c | 2 +-
test/testpen.c | 2 +-
test/testsprite.c | 2 +-
37 files changed, 48 insertions(+), 42 deletions(-)
diff --git a/docs/README-main-functions.md b/docs/README-main-functions.md
index f7e797ac4d88f..e36654fc3ecfd 100644
--- a/docs/README-main-functions.md
+++ b/docs/README-main-functions.md
@@ -190,7 +190,7 @@ to SDL_EVENT_QUIT, etc.
Finally:
```c
-void SDL_AppQuit(void *appstate);
+void SDL_AppQuit(void *appstate, SDL_AppResult result);
This is called once before terminating the app–assuming the app isn’t being
@@ -201,3 +201,6 @@ from main(), so atexit handles will run, if your platform supports that.
If you set *appstate
during SDL_AppInit, this is where you should free that
data, as this pointer will not be provided to your app again.
+
+The SDL_AppResult value that terminated the app is provided here, in case
+it’s useful to know if this was a successful or failing run of the app.
diff --git a/examples/audio/01-simple-playback/simple-playback.c b/examples/audio/01-simple-playback/simple-playback.c
index 7c19e9e2821a1…813e8317b24dc 100644
— a/examples/audio/01-simple-playback/simple-playback.c
+++ b/examples/audio/01-simple-playback/simple-playback.c
@@ -92,7 +92,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
/ SDL will clean up the window/renderer for us. */
}
diff --git a/examples/audio/02-simple-playback-callback/simple-playback-callback.c b/examples/audio/02-simple-playback-callback/simple-playback-callback.c
index 2e6078435a960…221e92a6634c1 100644
— a/examples/audio/02-simple-playback-callback/simple-playback-callback.c
+++ b/examples/audio/02-simple-playback-callback/simple-playback-callback.c
@@ -104,7 +104,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
/ SDL will clean up the window/renderer for us. */
}
diff --git a/examples/audio/03-load-wav/load-wav.c b/examples/audio/03-load-wav/load-wav.c
index 512dff7bd2c7c…79236525c993c 100644
— a/examples/audio/03-load-wav/load-wav.c
+++ b/examples/audio/03-load-wav/load-wav.c
@@ -93,7 +93,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
SDL_free(wav_data); / strictly speaking, this isn’t necessary because the process is ending, but it’s good policy. /
/ SDL will clean up the window/renderer for us. */
diff --git a/examples/camera/01-read-and-draw/read-and-draw.c b/examples/camera/01-read-and-draw/read-and-draw.c
index 6b33443c313bf…9fbe616ce49d0 100644
— a/examples/camera/01-read-and-draw/read-and-draw.c
+++ b/examples/camera/01-read-and-draw/read-and-draw.c
@@ -103,7 +103,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
SDL_CloseCamera(camera);
SDL_DestroyTexture(texture);
diff --git a/examples/game/01-snake/snake.c b/examples/game/01-snake/snake.c
index 3015b5df41057…7a9e87cf4b18f 100644
— a/examples/game/01-snake/snake.c
+++ b/examples/game/01-snake/snake.c
@@ -320,7 +320,7 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
return SDL_APP_CONTINUE;
}
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
if (appstate != NULL) {
AppState *as = (AppState *)appstate;
diff --git a/examples/pen/01-drawing-lines/drawing-lines.c b/examples/pen/01-drawing-lines/drawing-lines.c
index c772e9a26b632…29bc2c43bffaa 100644
— a/examples/pen/01-drawing-lines/drawing-lines.c
+++ b/examples/pen/01-drawing-lines/drawing-lines.c
@@ -96,7 +96,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
SDL_DestroyTexture(render_target);
/ SDL will clean up the window/renderer for us. */
diff --git a/examples/renderer/01-clear/clear.c b/examples/renderer/01-clear/clear.c
index 8feee980b0618…6de14bae36f51 100644
— a/examples/renderer/01-clear/clear.c
+++ b/examples/renderer/01-clear/clear.c
@@ -59,7 +59,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
/ SDL will clean up the window/renderer for us. */
}
diff --git a/examples/renderer/02-primitives/primitives.c b/examples/renderer/02-primitives/primitives.c
index daa4be28fd053…89bc7f57c4e50 100644
— a/examples/renderer/02-primitives/primitives.c
+++ b/examples/renderer/02-primitives/primitives.c
@@ -86,7 +86,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
/ SDL will clean up the window/renderer for us. */
}
diff --git a/examples/renderer/03-lines/lines.c b/examples/renderer/03-lines/lines.c
index 031077000b562…ed121f504deda 100644
— a/examples/renderer/03-lines/lines.c
+++ b/examples/renderer/03-lines/lines.c
@@ -84,7 +84,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
/ SDL will clean up the window/renderer for us. */
}
diff --git a/examples/renderer/04-points/points.c b/examples/renderer/04-points/points.c
index c98fb9b32c142…d34a966559aa0 100644
— a/examples/renderer/04-points/points.c
+++ b/examples/renderer/04-points/points.c
@@ -109,7 +109,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
/ SDL will clean up the window/renderer for us. */
}
diff --git a/examples/renderer/05-rectangles/rectangles.c b/examples/renderer/05-rectangles/rectangles.c
index 2fd2ba8074f7b…95f4864a674ba 100644
— a/examples/renderer/05-rectangles/rectangles.c
+++ b/examples/renderer/05-rectangles/rectangles.c
@@ -103,7 +103,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
/ SDL will clean up the window/renderer for us. */
}
diff --git a/examples/renderer/06-textures/textures.c b/examples/renderer/06-textures/textures.c
index a0bdb6c132d3c…12fe70bcbb226 100644
— a/examples/renderer/06-textures/textures.c
+++ b/examples/renderer/06-textures/textures.c
@@ -117,7 +117,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
SDL_DestroyTexture(texture);
/ SDL will clean up the window/renderer for us. */
diff --git a/examples/renderer/07-streaming-textures/streaming-textures.c b/examples/renderer/07-streaming-textures/streaming-textures.c
index 6b3a2d294506b…3bbae3557e372 100644
— a/examples/renderer/07-streaming-textures/streaming-textures.c
+++ b/examples/renderer/07-streaming-textures/streaming-textures.c
@@ -99,7 +99,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
SDL_DestroyTexture(texture);
/ SDL will clean up the window/renderer for us. */
diff --git a/examples/renderer/08-rotating-textures/rotating-textures.c b/examples/renderer/08-rotating-textures/rotating-textures.c
index b7121124104b6…850d0e5056373 100644
— a/examples/renderer/08-rotating-textures/rotating-textures.c
+++ b/examples/renderer/08-rotating-textures/rotating-textures.c
@@ -103,7 +103,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
SDL_DestroyTexture(texture);
/ SDL will clean up the window/renderer for us. */
diff --git a/examples/renderer/09-scaling-textures/scaling-textures.c b/examples/renderer/09-scaling-textures/scaling-textures.c
index bcb9845f029db…dc1cb35956434 100644
— a/examples/renderer/09-scaling-textures/scaling-textures.c
+++ b/examples/renderer/09-scaling-textures/scaling-textures.c
@@ -100,7 +100,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
SDL_DestroyTexture(texture);
/ SDL will clean up the window/renderer for us. */
diff --git a/examples/renderer/10-geometry/geometry.c b/examples/renderer/10-geometry/geometry.c
index b5621f872daa9…2d85812af0363 100644
— a/examples/renderer/10-geometry/geometry.c
+++ b/examples/renderer/10-geometry/geometry.c
@@ -156,7 +156,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
SDL_DestroyTexture(texture);
/ SDL will clean up the window/renderer for us. */
diff --git a/examples/renderer/11-color-mods/color-mods.c b/examples/renderer/11-color-mods/color-mods.c
index 21ae66a02417c…f6b9c2cbdb8a2 100644
— a/examples/renderer/11-color-mods/color-mods.c
+++ b/examples/renderer/11-color-mods/color-mods.c
@@ -124,7 +124,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
SDL_DestroyTexture(texture);
/ SDL will clean up the window/renderer for us. */
diff --git a/examples/renderer/14-viewport/viewport.c b/examples/renderer/14-viewport/viewport.c
index 3001a61dc63e2…096b799cd661b 100644
— a/examples/renderer/14-viewport/viewport.c
+++ b/examples/renderer/14-viewport/viewport.c
@@ -126,7 +126,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
SDL_DestroyTexture(texture);
/ SDL will clean up the window/renderer for us. */
diff --git a/examples/renderer/15-cliprect/cliprect.c b/examples/renderer/15-cliprect/cliprect.c
index 0b4801f2fbe69…4c69f47ecf9c0 100644
— a/examples/renderer/15-cliprect/cliprect.c
+++ b/examples/renderer/15-cliprect/cliprect.c
@@ -127,7 +127,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
SDL_DestroyTexture(texture);
/ SDL will clean up the window/renderer for us. */
diff --git a/examples/renderer/17-read-pixels/read-pixels.c b/examples/renderer/17-read-pixels/read-pixels.c
index 35af871e6ed75…b2cb523086f00 100644
— a/examples/renderer/17-read-pixels/read-pixels.c
+++ b/examples/renderer/17-read-pixels/read-pixels.c
@@ -167,7 +167,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
SDL_DestroyTexture(converted_texture);
SDL_DestroyTexture(texture);
diff --git a/examples/template.c b/examples/template.c
index a5cc995688bb0…331db683e0400 100644
— a/examples/template.c
+++ b/examples/template.c
@@ -44,7 +44,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
/* This function runs once at shutdown. */
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
/ SDL will clean up the window/renderer for us. */
}
diff --git a/include/SDL3/SDL_init.h b/include/SDL3/SDL_init.h
index 10706c37ee50b…9029734339258 100644
— a/include/SDL3/SDL_init.h
+++ b/include/SDL3/SDL_init.h
@@ -96,7 +96,7 @@ typedef enum SDL_AppResult
typedef SDL_AppResult (SDLCALL *SDL_AppInit_func)(void **appstate, int argc, char *argv);
typedef SDL_AppResult (SDLCALL *SDL_AppIterate_func)(void *appstate);
typedef SDL_AppResult (SDLCALL *SDL_AppEvent_func)(void *appstate, SDL_Event *event);
-typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate);
+typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate, SDL_AppResult result);
/**
- Initialize the SDL library.
diff --git a/include/SDL3/SDL_main.h b/include/SDL3/SDL_main.h
index b5cad4c7ef97a…e173bd5c694e6 100644
— a/include/SDL3/SDL_main.h
+++ b/include/SDL3/SDL_main.h
@@ -372,6 +372,7 @@ extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_E - resources to it should be cleaned up here.
- \param appstate an optional pointer, provided by the app in SDL_AppInit.
-
- \param result the result code that terminated the app (success or failure).
- \threadsafety This function is not thread safe.
@@ -379,7 +380,7 @@ extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_E
*
- \sa SDL_AppInit
*/
-extern SDLMAIN_DECLSPEC void SDLCALL SDL_AppQuit(void *appstate);
+extern SDLMAIN_DECLSPEC void SDLCALL SDL_AppQuit(void *appstate, SDL_AppResult result);
#endif /* SDL_MAIN_USE_CALLBACKS */
diff --git a/src/main/SDL_main_callbacks.c b/src/main/SDL_main_callbacks.c
index ad967ea8ff2cf…60316c0943981 100644
— a/src/main/SDL_main_callbacks.c
+++ b/src/main/SDL_main_callbacks.c
@@ -130,10 +130,10 @@ SDL_AppResult SDL_IterateMainCallbacks(bool pump_events)
return rc;
}
-void SDL_QuitMainCallbacks(void)
+void SDL_QuitMainCallbacks(SDL_AppResult result)
{
SDL_RemoveEventWatch(SDL_MainCallbackEventWatcher, NULL);
- SDL_main_quit_callback(SDL_main_appstate);
-
SDL_main_quit_callback(SDL_main_appstate, result);
SDL_main_appstate = NULL; // just in case.// for symmetry, you should explicitly Quit what you Init, but we might come through here uninitialized and SDL_Quit() will clear everything anyhow.
diff --git a/src/main/SDL_main_callbacks.h b/src/main/SDL_main_callbacks.h
index 0bac5a5c638ab…e8ba85ebd2a41 100644
— a/src/main/SDL_main_callbacks.h
+++ b/src/main/SDL_main_callbacks.h
@@ -25,7 +25,7 @@
bool SDL_HasMainCallbacks(void);
SDL_AppResult SDL_InitMainCallbacks(int argc, char *argv, SDL_AppInit_func appinit, SDL_AppIterate_func _appiter, SDL_AppEvent_func _appevent, SDL_AppQuit_func _appquit);
SDL_AppResult SDL_IterateMainCallbacks(bool pump_events);
-void SDL_QuitMainCallbacks(void);
+void SDL_QuitMainCallbacks(SDL_AppResult result);
#endif // SDL_main_callbacks_h_
diff --git a/src/main/emscripten/SDL_sysmain_callbacks.c b/src/main/emscripten/SDL_sysmain_callbacks.c
index 9da67f38c1fd6…bee253eb523e9 100644
— a/src/main/emscripten/SDL_sysmain_callbacks.c
+++ b/src/main/emscripten/SDL_sysmain_callbacks.c
@@ -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;
}
diff --git a/src/main/generic/SDL_sysmain_callbacks.c b/src/main/generic/SDL_sysmain_callbacks.c
index 05fc54b29e93c…aa59d324558ed 100644
— a/src/main/generic/SDL_sysmain_callbacks.c
+++ b/src/main/generic/SDL_sysmain_callbacks.c
@@ -75,7 +75,7 @@ int SDL_EnterAppMainCallbacks(int argc, char* argv, SDL_AppInit_func appinit,SDL_RemoveHintCallback(SDL_HINT_MAIN_CALLBACK_RATE, MainCallbackRateHintChanged, NULL);
}
- SDL_QuitMainCallbacks();
-
SDL_QuitMainCallbacks(rc);
return (rc == SDL_APP_FAILURE) ? 1 : 0;
}
diff --git a/src/main/ios/SDL_sysmain_callbacks.m b/src/main/ios/SDL_sysmain_callbacks.m
index ee37af36a7aa2…336f3a367eaca 100644
— a/src/main/ios/SDL_sysmain_callbacks.m
+++ b/src/main/ios/SDL_sysmain_callbacks.m
@@ -55,7 +55,7 @@ - (void)appIteration:(CADisplayLink *)sender
[self.displayLink invalidate];
self.displayLink = nil;
globalDisplayLink = nil;
-
SDL_QuitMainCallbacks();
-
}SDL_QuitMainCallbacks(rc); SDL_UpdateLifecycleObserver(); exit((rc == SDL_APP_FAILURE) ? 1 : 0);
@@ -66,16 +66,18 @@ - (void)appIteration:(CADisplayLink )sender
// When we return from here, we’re living in the RunLoop, and a CADisplayLink is firing regularly for us.
int SDL_EnterAppMainCallbacks(int argc, char argv, SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
{
- const SDL_AppResult rc = SDL_InitMainCallbacks(argc, argv, appinit, appiter, appevent, appquit);
- SDL_AppResult rc = SDL_InitMainCallbacks(argc, argv, appinit, appiter, appevent, appquit);
if (rc == SDL_APP_CONTINUE) {
globalDisplayLink = [[SDLIosMainCallbacksDisplayLink alloc] init:appiter quitfunc:appquit];
-
if (globalDisplayLink != nil) {
-
if (globalDisplayLink == nil) {
-
rc = SDL_APP_FAILURE;
-
} else { return 0; // this will fall all the way out of SDL_main, where UIApplicationMain will keep running the RunLoop. }
}
// appinit requested quit, just bounce out now.
- SDL_QuitMainCallbacks();
-
SDL_QuitMainCallbacks(rc);
exit((rc == SDL_APP_FAILURE) ? 1 : 0);return 1; // just in case.
diff --git a/test/loopwave.c b/test/loopwave.c
index be5038d7e4401…77ed7316462e3 100644
— a/test/loopwave.c
+++ b/test/loopwave.c
@@ -127,7 +127,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
return fillerup();
}
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
SDL_DestroyAudioStream(stream);
SDL_free(wave.sound);
diff --git a/test/testaudio.c b/test/testaudio.c
index e4ccf18ca9e3d…7eb6e75c1b6ee 100644
— a/test/testaudio.c
+++ b/test/testaudio.c
@@ -1256,7 +1256,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
return SDL_APP_CONTINUE;
}
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
while (things) {
DestroyThing(things); / make sure all the audio devices are closed, etc. */
diff --git a/test/testaudiorecording.c b/test/testaudiorecording.c
index 1189f0fb36090…3c0f18b0b3178 100644
— a/test/testaudiorecording.c
+++ b/test/testaudiorecording.c
@@ -196,7 +196,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
return SDL_APP_CONTINUE;
}
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
SDL_Log(“Shutting down.\n”);
const SDL_AudioDeviceID devid_in = SDL_GetAudioStreamDevice(stream_in);
diff --git a/test/testcamera.c b/test/testcamera.c
index 1cc21a4af9e4e…893af67119220 100644
— a/test/testcamera.c
+++ b/test/testcamera.c
@@ -353,7 +353,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
return SDL_APP_CONTINUE;
}
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
SDL_ReleaseCameraFrame(camera, frame_current);
SDL_CloseCamera(camera);
diff --git a/test/testdropfile.c b/test/testdropfile.c
index 10395539c605d…c7d8dcd06acd8 100644
— a/test/testdropfile.c
+++ b/test/testdropfile.c
@@ -114,7 +114,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
return SDL_APP_CONTINUE;
}
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
dropfile_dialog *dialog = appstate;
if (dialog) {
diff --git a/test/testgpu_simple_clear.c b/test/testgpu_simple_clear.c
index 099cd0b485201…93d9d60c74a16 100644
— a/test/testgpu_simple_clear.c
+++ b/test/testgpu_simple_clear.c
@@ -110,7 +110,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
return SDL_APP_CONTINUE;
}
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void appstate, SDL_AppResult result)
{
/ Print out some timing information */
const Uint64 now = SDL_GetTicks();
diff --git a/test/testpen.c b/test/testpen.c
index 68fa2123b833c…ef58c0fc49739 100644
— a/test/testpen.c
+++ b/test/testpen.c
@@ -273,7 +273,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
return SDL_APP_CONTINUE;
}
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
Pen *i, next;
for (i = pens.next; i != NULL; i = next) {
diff --git a/test/testsprite.c b/test/testsprite.c
index 9568efa970fcc…1c9fdddb0bd76 100644
— a/test/testsprite.c
+++ b/test/testsprite.c
@@ -42,7 +42,7 @@ static bool suspend_when_occluded;
/ -1: infinite random moves (default); >=0: enables N deterministic moves */
static int iterations = -1;
-void SDL_AppQuit(void *appstate)
+void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
SDL_free(sprites);
SDL_free(positions);