# HG changeset patch # User nenolod # Date 1131670116 28800 # Node ID 0faf2fa7fc8546d0631da89106312b494e1f40cc # Parent 32c320bba8a6a4595cb9239fc9422646ce40d545 [svn] More thread safety, less XMMS braindamage. diff -r 32c320bba8a6 -r 0faf2fa7fc85 audacious/playback.c --- a/audacious/playback.c Thu Nov 10 16:40:09 2005 -0800 +++ b/audacious/playback.c Thu Nov 10 16:48:36 2005 -0800 @@ -125,6 +125,8 @@ void bmp_playback_pause(void) { + g_mutex_lock(ip_data.playback_mutex); + if (!bmp_playback_get_playing()) return; @@ -139,6 +141,8 @@ playstatus_set_status(mainwin_playstatus, STATUS_PLAY); get_current_input_plugin()->pause(ip_data.paused); + + g_mutex_unlock(ip_data.playback_mutex); } void @@ -171,6 +175,32 @@ g_mutex_free(ip_data.playback_mutex); } +void +bmp_playback_stop_reentrant(void) +{ + g_mutex_lock(ip_data.playback_mutex); + + if (ip_data.playing && get_current_input_plugin()) { + ip_data.playing = FALSE; + + if (bmp_playback_get_paused()) + bmp_playback_pause(); + + free_vis_data(); + ip_data.paused = FALSE; + + if (input_info_text) { + g_free(input_info_text); + input_info_text = NULL; + mainwin_set_info_text(); + } + } + + ip_data.playing = FALSE; + + g_mutex_unlock(ip_data.playback_mutex); + g_mutex_free(ip_data.playback_mutex); +} static void run_no_output_plugin_dialog(void) diff -r 32c320bba8a6 -r 0faf2fa7fc85 audacious/playback.h --- a/audacious/playback.h Thu Nov 10 16:40:09 2005 -0800 +++ b/audacious/playback.h Thu Nov 10 16:48:36 2005 -0800 @@ -26,6 +26,7 @@ void bmp_playback_initiate(void); void bmp_playback_pause(void); void bmp_playback_stop(void); +void bmp_playback_stop_reentrant(void); gboolean bmp_playback_play_file(const gchar * filename); gboolean bmp_playback_get_playing(void); gboolean bmp_playback_get_paused(void);