From 71c760de14d41fd2430a37003a402ee493a82ceb Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 21 Oct 2020 15:04:13 +0200 Subject: [PATCH] pulse: fix cleanup of the stream When the pa_stream is destroyed we need to remove it from the global, if any (and not when the pw_stream is destroyed). Fixes crash in gnome-control-center when switching sinks. See #343 --- pipewire-pulseaudio/src/stream.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pipewire-pulseaudio/src/stream.c b/pipewire-pulseaudio/src/stream.c index db601e7e9..4e1a2f8af 100644 --- a/pipewire-pulseaudio/src/stream.c +++ b/pipewire-pulseaudio/src/stream.c @@ -56,8 +56,6 @@ static void stream_destroy(void *data) { pa_stream *s = data; s->stream = NULL; - if (s->global) - s->global->stream = NULL; } static void stream_state_changed(void *data, enum pw_stream_state old, @@ -678,10 +676,13 @@ static void stream_free(pa_stream *s) pw_log_debug("stream %p", s); + if (s->stream) { spa_hook_remove(&s->stream_listener); pw_stream_destroy(s->stream); } + if (s->global) + s->global->stream = NULL; spa_list_consume(m, &s->free, link) { pw_log_trace("free %p", m);