]> code.delx.au - pulseaudio/commitdiff
jack: Prevent crash on jack server shutdown
authorDavid Henningsson <diwic@ubuntu.com>
Mon, 3 May 2010 09:41:47 +0000 (11:41 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 7 May 2010 23:30:55 +0000 (01:30 +0200)
src/modules/jack/module-jack-sink.c
src/modules/jack/module-jack-source.c

index 4a0d38475a98b13d4c70c6ebd689db7c01c072f1..08a8befa38be38056521a3ebb6229ab67f79bdd5 100644 (file)
@@ -147,6 +147,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
                 pa_sample_spec ss;
 
                 /* Humm, we're not RUNNING, hence let's write some silence */
+                /* This can happen if we're paused, or during shutdown (when we're unlinked but jack is still running). */
 
                 ss = u->sink->sample_spec;
                 ss.channels = 1;
@@ -480,12 +481,12 @@ void pa__done(pa_module*m) {
     if (!(u = m->userdata))
         return;
 
-    if (u->client)
-        jack_client_close(u->client);
-
     if (u->sink)
         pa_sink_unlink(u->sink);
 
+    if (u->client)
+        jack_client_close(u->client);
+
     if (u->thread) {
         pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0, NULL);
         pa_thread_free(u->thread);
index 2d152b38992b4a0d66c097087f87788987884ac6..6b1284026e642866730cf91ede94e267b9ace5f4 100644 (file)
@@ -425,12 +425,12 @@ void pa__done(pa_module*m) {
     if (!(u = m->userdata))
         return;
 
-    if (u->client)
-        jack_client_close(u->client);
-
     if (u->source)
         pa_source_unlink(u->source);
 
+    if (u->client)
+        jack_client_close(u->client);
+
     if (u->thread) {
         pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0, NULL);
         pa_thread_free(u->thread);