diff src/flacng/plugin.c @ 969:0ee1070d1741 trunk

[svn] - Properly wait for the flac decoder thread to finish
author ertzing
date Fri, 20 Apr 2007 13:29:12 -0700
parents b6c95e2a14f4
children b1128efde471
line wrap: on
line diff
--- a/src/flacng/plugin.c	Fri Apr 20 07:42:53 2007 -0700
+++ b/src/flacng/plugin.c	Fri Apr 20 13:29:12 2007 -0700
@@ -67,7 +67,7 @@
 callback_info* main_info;
 gboolean plugin_initialized = FALSE;
 gint seek_to = -1;
-static GThread* thread;
+static GThread* thread = NULL;
 GMutex* flac_pl_mutex;
 
 /* === */
@@ -590,6 +590,16 @@
 
     input->playing = FALSE;
 
+    if (NULL != thread) {
+        /*
+         * Wait for the decoder thread to finish
+         */
+        _DEBUG("Waiting for decoder thread to die...");
+        g_thread_join(thread);
+        thread = NULL;
+        _DEBUG("Decoder thread has finished");
+    }
+
     _LEAVE;
 }