mirror of
https://github.com/libsdl-org/SDL.git
synced 2024-11-23 02:43:30 +08:00
Make sure we call SDL_Quit() before SDLTest_CommonDestroyState()
Otherwise we'll report leaks that will be cleaned up in SDL_Quit()
This commit is contained in:
parent
b5ad74998b
commit
728bf363cb
@ -156,6 +156,8 @@ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, SDL_InitFlags flags)
|
||||
/**
|
||||
* Free the common state object.
|
||||
*
|
||||
* You should call SDL_Quit() before calling this function.
|
||||
*
|
||||
* \param state The common state object to destroy
|
||||
*/
|
||||
void SDLTest_CommonDestroyState(SDLTest_CommonState *state);
|
||||
|
@ -134,6 +134,7 @@ void SDL_AppQuit(void *appstate)
|
||||
{
|
||||
SDL_DestroyAudioStream(stream);
|
||||
SDL_free(wave.sound);
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
}
|
||||
|
||||
|
@ -210,8 +210,8 @@ void SDL_AppQuit(void *appstate)
|
||||
SDL_DestroyAudioStream(stream_out);
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
SDLTest_CommonDestroyState(state);
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,6 +74,7 @@ int SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
NULL,
|
||||
};
|
||||
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return 1;
|
||||
}
|
||||
|
@ -2243,6 +2243,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
result = run_test() ? 0 : 1;
|
||||
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return result;
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ iostrm_error_quit(unsigned line, SDL_IOStream *iostrm)
|
||||
SDL_CloseIO(iostrm);
|
||||
}
|
||||
cleanup();
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
exit(1); /* quit with iostrm error (test failed) */
|
||||
}
|
||||
|
@ -483,8 +483,8 @@ int main(int argc, char *argv[])
|
||||
status += Test64Bit(verbose);
|
||||
status += TestCPUInfo(verbose);
|
||||
status += TestAssertions(verbose);
|
||||
SDL_Quit();
|
||||
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
|
||||
return status;
|
||||
|
@ -135,6 +135,7 @@ int main(int argc, char *argv[])
|
||||
test_sort("random sorted", nums, arraylen);
|
||||
}
|
||||
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
|
||||
return 0;
|
||||
|
@ -171,8 +171,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
SDL_Log("Reader threads have terminated, quitting!");
|
||||
SDL_DestroyRWLock(rwlock);
|
||||
SDLTest_CommonDestroyState(state);
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ int main(int argc, char **argv)
|
||||
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
|
||||
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return 1;
|
||||
}
|
||||
@ -79,6 +80,7 @@ int main(int argc, char **argv)
|
||||
/* Load the SDL library */
|
||||
if (SDL_Init(SDL_INIT_SENSOR) < 0) {
|
||||
SDL_Log("Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return 1;
|
||||
}
|
||||
|
@ -149,6 +149,7 @@ int main(int argc, char **argv)
|
||||
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
|
||||
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return 1;
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ static SDLTest_CommonState *state;
|
||||
static void
|
||||
quit(int rc)
|
||||
{
|
||||
SDLTest_CommonDestroyState(state);
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
/* Let 'main()' return normally */
|
||||
if (rc != 0) {
|
||||
exit(rc);
|
||||
|
@ -396,6 +396,7 @@ int main(int argc, char **argv)
|
||||
NULL,
|
||||
};
|
||||
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return 1;
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user