diff -Nuar tuxpaint/src/tuxpaint.c tuxpaint/src/tuxpaint.c --- tuxpaint/src/tuxpaint.c 2010-05-10 14:49:30.000000000 +0200 +++ tuxpaint/src/tuxpaint.c 2010-05-10 14:53:22.000000000 +0200 @@ -1847,7 +1847,7 @@ cleanup(); - return 0; + exit(0); } @@ -7013,6 +7013,10 @@ if (SDL_Init(init_flags) >= 0) { /* worked, w/o sound */ + + /* Use atexit after Init to avoid freeze on exit */ + atexit(Mix_CloseAudio); + atexit(SDL_Quit); fprintf(stderr, "\nWarning: I could not initialize audio!\n" "The Simple DirectMedia Layer error that occurred was:\n" @@ -12252,7 +12256,7 @@ } } - Mix_CloseAudio(); + //Mix_CloseAudio(); } #endif @@ -12332,7 +12336,7 @@ /* FIXME: Pango contexts lying around? -bjk 2007.07.24 */ TTF_Quit(); - SDL_Quit(); + //SDL_Quit(); } @@ -15129,7 +15133,10 @@ #ifndef NOSOUND if (use_sound) { + /* Close channels to avoid loop */ + Mix_HaltChannel(-1); while (Mix_Playing(-1)) + printf("%d channels are playing\n", Mix_Playing(-1)); SDL_Delay(10); } #endif