From 12cf6da242d9cbca37f8fc541d6261f165f181d2 Mon Sep 17 00:00:00 2001 From: Georg Chini Date: Sun, 31 Jan 2021 20:08:11 +0100 Subject: [PATCH] sink: Unlink monitor source before unlinking sink Unlinking the monitor source after unlinking the sink leads to a crash when the monitor source is master of a virtual source. Changing the unlink order fixes the problem. Part-of: --- src/pulsecore/sink.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index e8aeb17..90dc250 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -784,6 +784,10 @@ void pa_sink_unlink(pa_sink* s) { j = i; } + /* Unlink monitor source before unlinking the sink */ + if (s->monitor_source) + pa_source_unlink(s->monitor_source); + if (linked) /* It's important to keep the suspend cause unchanged when unlinking, * because if we remove the SESSION suspend cause here, the alsa sink @@ -795,9 +799,6 @@ void pa_sink_unlink(pa_sink* s) { reset_callbacks(s); - if (s->monitor_source) - pa_source_unlink(s->monitor_source); - if (linked) { pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_REMOVE, s->index); pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_UNLINK_POST], s); -- 2.7.4