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.
This commit is contained in:
Wim Taymans 2022-04-01 09:57:40 +02:00
parent 4a5129bdb4
commit da10a2ad60

View file

@ -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);