Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv15643/src Modified Files: sound.c Log Message: Clean up sound resources on exit. COW should adopt this as well. Index: sound.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/sound.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- sound.c 23 Feb 2007 13:43:57 -0000 1.27 +++ sound.c 26 Feb 2007 13:20:37 -0000 1.28 @@ -171,6 +171,25 @@ return(1); } +extern void sound_cleanup (void) +{ + int i; + + //Free the sound effects + for (i = 0; i < NUM_WAVES; i++) + Mix_FreeChunk(newsounds[i]); + + //Free the music + for (i = 0; i < NUM_MUSIC; i++) + Mix_FreeMusic(newmusic[i]); + + //Quit SDL_mixer + Mix_CloseAudio(); + + //Quit SDL + SDL_Quit(); +} + extern void Exit_Sound (void) { if (sound_init) @@ -211,7 +230,7 @@ if (SDL_Init(SDL_INIT_AUDIO) < 0) LineToConsole("Couldn't initialize SDL: %s\n",SDL_GetError()); - atexit(SDL_Quit); + atexit(sound_cleanup); /* Open the audio device at 22050 Hz 8 bit Microsoft PCM with stereo */ if (Mix_OpenAudio(22050, AUDIO_S16SYS, 2, 1024) < 0)