From da10a2ad604cc75851b9181da95779f2dc486243 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 1 Apr 2022 09:57:40 +0200 Subject: [PATCH] context: destroy data-loop in free Just stop the data-loop before destroying the modules because they might still try to access it. Destroy the data-loop in the free phase instead. Fixes a valgrind error where module-rt tries to clear the thread-utils, which causes the context to try to clear the thread-utils on the already freed data-loop. --- src/pipewire/context.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pipewire/context.c b/src/pipewire/context.c index edd9bc923..6045d0463 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -464,7 +464,7 @@ void pw_context_destroy(struct pw_context *context) pw_resource_destroy(resource); if (context->data_loop_impl) - pw_data_loop_destroy(context->data_loop_impl); + pw_data_loop_stop(context->data_loop_impl); spa_list_consume(module, &context->module_list, link) pw_impl_module_destroy(module); @@ -481,6 +481,9 @@ void pw_context_destroy(struct pw_context *context) pw_log_debug("%p: free", context); pw_context_emit_free(context); + if (context->data_loop_impl) + pw_data_loop_destroy(context->data_loop_impl); + if (context->pool) pw_mempool_destroy(context->pool);