From aaaa541775d287107a66c762b44e848bf3ceab98 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 5 Jun 2020 17:34:16 +0200 Subject: [PATCH] stream: don't destroy proxy twice When the proxy was removed, we remove the event listener and don't set the proxy to NULL because the destroy event is not called anymore. If we then call disconnect twice, we try to destroy the proxy again and assert. --- src/pipewire/filter.c | 8 +++++--- src/pipewire/stream.c | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/pipewire/filter.c b/src/pipewire/filter.c index fdb401fac..dd26a04c0 100644 --- a/src/pipewire/filter.c +++ b/src/pipewire/filter.c @@ -881,6 +881,7 @@ static const struct spa_node_methods impl_node = { static void proxy_removed(void *_data) { struct pw_filter *filter = _data; + pw_log_debug(NAME" %p: removed", filter); spa_hook_remove(&filter->proxy_listener); filter->node_id = SPA_ID_INVALID; filter_set_state(filter, PW_FILTER_STATE_UNCONNECTED, NULL); @@ -889,8 +890,8 @@ static void proxy_removed(void *_data) static void proxy_destroy(void *_data) { struct pw_filter *filter = _data; + pw_log_debug(NAME" %p: destroy", filter); proxy_removed(_data); - filter->proxy = NULL; } static void proxy_error(void *_data, int seq, int res, const char *message) @@ -1280,9 +1281,10 @@ int pw_filter_disconnect(struct pw_filter *filter) pw_log_debug(NAME" %p: disconnect", filter); impl->disconnecting = true; - if (filter->proxy) + if (filter->proxy) { pw_proxy_destroy(filter->proxy); - + filter->proxy = NULL; + } if (impl->disconnect_core) { impl->disconnect_core = false; spa_hook_remove(&filter->core_listener); diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index bc157c8c4..883054b76 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -841,7 +841,6 @@ static void proxy_destroy(void *_data) struct pw_stream *stream = _data; pw_log_debug(NAME" %p: destroy", stream); proxy_removed(_data); - stream->proxy = NULL; } static void proxy_error(void *_data, int seq, int res, const char *message) @@ -1582,8 +1581,10 @@ int pw_stream_disconnect(struct pw_stream *stream) if (impl->node) pw_impl_node_set_active(impl->node, false); - if (stream->proxy) + if (stream->proxy) { pw_proxy_destroy(stream->proxy); + stream->proxy = NULL; + } if (impl->node) { pw_impl_node_destroy(impl->node);