Index: client/audio.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/audio.c,v retrieving revision 1.7 diff -u -r1.7 audio.c --- client/audio.c 2002/05/24 07:59:05 1.7 +++ client/audio.c 2002/06/21 10:09:34 @@ -17,6 +17,7 @@ #include #include +#include #include "support.h" #include "fcintl.h" @@ -76,6 +77,8 @@ if (found && i != selected_plugin) { freelog(LOG_DEBUG, "Shutting down %s", plugins[selected_plugin].name); + plugins[selected_plugin].stop(); + plugins[selected_plugin].wait(); plugins[selected_plugin].shutdown(); } @@ -163,6 +166,8 @@ exit(EXIT_FAILURE); } + atexit(audio_shutdown); + if (prefered_plugin_name && audio_select_plugin(prefered_plugin_name)) { return; } @@ -261,8 +266,16 @@ audio_play_sound("e_game_quit", NULL); plugins[selected_plugin].wait(); plugins[selected_plugin].shutdown(); + + /* + * Select the dummy interface so that audio_shutdown can be called + * multiple times. + */ + selected_plugin = 0; + if (tagfile) { section_file_free(tagfile); + tagfile = NULL; } }