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
This commit is contained in:
Wim Taymans 2020-10-21 15:04:13 +02:00
parent fc18a8ffbd
commit 71c760de14

View file

@ -56,8 +56,6 @@ static void stream_destroy(void *data)
{ {
pa_stream *s = data; pa_stream *s = data;
s->stream = NULL; s->stream = NULL;
if (s->global)
s->global->stream = NULL;
} }
static void stream_state_changed(void *data, enum pw_stream_state old, 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); pw_log_debug("stream %p", s);
if (s->stream) { if (s->stream) {
spa_hook_remove(&s->stream_listener); spa_hook_remove(&s->stream_listener);
pw_stream_destroy(s->stream); pw_stream_destroy(s->stream);
} }
if (s->global)
s->global->stream = NULL;
spa_list_consume(m, &s->free, link) { spa_list_consume(m, &s->free, link) {
pw_log_trace("free %p", m); pw_log_trace("free %p", m);