We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3740

Summary: atexit() in test/testime.c
Product: SDL Reporter: Ozkan Sezer <sezeroz>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: trivial    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: All   

Description Ozkan Sezer 2017-08-13 10:47:25 UTC
It is bad practice doing atexit(SDL_Quit), because calling conventions
may be different.  A quick fix for test/testime.c is using a wrapper,
like:

diff -r f7abcb63e51e test/testime.c
--- a/test/testime.c	Sun Aug 13 01:00:01 2017 -0400
+++ b/test/testime.c	Sun Aug 13 11:23:10 2017 +0300
@@ -623,6 +623,10 @@ void Redraw() {
     }
 }
 
+static void quit (void) {
+    SDL_Quit();
+}
+
 int main(int argc, char *argv[]) {
     int i, done;
     SDL_Event event;
@@ -680,7 +684,7 @@ int main(int argc, char *argv[]) {
 #endif
 
     SDL_Log("Using font: %s\n", fontname);
-    atexit(SDL_Quit);
+    atexit(quit);
 
     InitInput();
     /* Create the windows and initialize the renderers */
Comment 1 Sam Lantinga 2017-08-28 02:00:29 UTC
I removed exit() from testime, thanks!
https://hg.libsdl.org/SDL/rev/b83e2eaed190