summaryrefslogtreecommitdiff
path: root/plugins/alsa
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-04 21:07:49 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-04 21:07:49 +0100
commitd822f6ecf3076b86594b40e0b9917956e7f4b468 (patch)
tree4648f3988d23346f0e7b39182184a42a65cc299d /plugins/alsa
parent70be4f4b0f4b67b88115ef690973c5ef5b2b57c2 (diff)
fixed alsa init regression crashbug
Diffstat (limited to 'plugins/alsa')
-rw-r--r--plugins/alsa/alsa.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c
index 2a5b9b2c..cae6e7c8 100644
--- a/plugins/alsa/alsa.c
+++ b/plugins/alsa/alsa.c
@@ -177,6 +177,8 @@ error:
int
palsa_init (void) {
int err;
+ alsa_tid = 0;
+ mutex = 0;
// get and cache conf variables
strcpy (conf_alsa_soundcard, deadbeef->conf_get_str ("alsa_soundcard", "default"));
@@ -294,11 +296,16 @@ palsa_free (void) {
if (audio && !alsa_terminate) {
alsa_terminate = 1;
printf ("waiting for alsa thread to finish\n");
- deadbeef->thread_join (alsa_tid);
- alsa_tid = 0;
+ if (alsa_tid) {
+ deadbeef->thread_join (alsa_tid);
+ alsa_tid = 0;
+ }
snd_pcm_close(audio);
audio = NULL;
- deadbeef->mutex_free (mutex);
+ if (mutex) {
+ deadbeef->mutex_free (mutex);
+ mutex = 0;
+ }
state = 0;
alsa_terminate = 0;
}