From dfc464413b70cc7334197b5e1fe8f4e7300ac100 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 28 Nov 2018 17:34:53 +0100 Subject: [PATCH] stream: set proxy to NULL in disconnect The proxy is NULL while disconnected, handle this case. --- src/pipewire/stream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index ccdb84202..6299acf7c 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -833,7 +833,7 @@ static void on_remote_state_changed(void *_data, enum pw_remote_state old, static void on_remote_exported(void *_data, uint32_t id) { struct pw_stream *stream = _data; - if (stream->proxy->id == id) + if (stream->proxy && stream->proxy->id == id) stream_set_state(stream, PW_STREAM_STATE_CONFIGURE, NULL); } @@ -1112,6 +1112,8 @@ pw_stream_connect(struct pw_stream *stream, uint32_t pw_stream_get_node_id(struct pw_stream *stream) { + if (stream->proxy == NULL) + return SPA_ID_INVALID; return stream->proxy->remote_id; } @@ -1126,6 +1128,7 @@ int pw_stream_disconnect(struct pw_stream *stream) pw_node_destroy(impl->node); impl->node = NULL; } + stream->proxy = NULL; stream_set_state(stream, PW_STREAM_STATE_UNCONNECTED, NULL); return 0; }