jack: Prevent crash on jack server shutdown

This commit is contained in:
David Henningsson 2010-05-03 11:41:47 +02:00 committed by Lennart Poettering
parent bc7314f14e
commit d519ca41d7
2 changed files with 7 additions and 6 deletions

View file

@ -147,6 +147,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
pa_sample_spec ss; pa_sample_spec ss;
/* Humm, we're not RUNNING, hence let's write some silence */ /* 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 = u->sink->sample_spec;
ss.channels = 1; ss.channels = 1;
@ -480,12 +481,12 @@ void pa__done(pa_module*m) {
if (!(u = m->userdata)) if (!(u = m->userdata))
return; return;
if (u->client)
jack_client_close(u->client);
if (u->sink) if (u->sink)
pa_sink_unlink(u->sink); pa_sink_unlink(u->sink);
if (u->client)
jack_client_close(u->client);
if (u->thread) { if (u->thread) {
pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0, NULL); pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0, NULL);
pa_thread_free(u->thread); pa_thread_free(u->thread);

View file

@ -425,12 +425,12 @@ void pa__done(pa_module*m) {
if (!(u = m->userdata)) if (!(u = m->userdata))
return; return;
if (u->client)
jack_client_close(u->client);
if (u->source) if (u->source)
pa_source_unlink(u->source); pa_source_unlink(u->source);
if (u->client)
jack_client_close(u->client);
if (u->thread) { if (u->thread) {
pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0, NULL); pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0, NULL);
pa_thread_free(u->thread); pa_thread_free(u->thread);