From 6d569b132f435755b55afd4c06ee19ea1a99a783 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 8 Mar 2018 11:03:50 +0100 Subject: [PATCH] control: safely iterate the list, unlink modifies the list --- src/pipewire/control.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pipewire/control.c b/src/pipewire/control.c index eee463d7b..f1c096cc6 100644 --- a/src/pipewire/control.c +++ b/src/pipewire/control.c @@ -85,14 +85,14 @@ pw_control_new(struct pw_core *core, void pw_control_destroy(struct pw_control *control) { struct impl *impl = SPA_CONTAINER_OF(control, struct impl, this); - struct pw_control *other; + struct pw_control *other, *tmp; pw_log_debug("control %p: destroy", control); spa_hook_list_call(&control->listener_list, struct pw_control_events, destroy); if (control->direction == SPA_DIRECTION_OUTPUT) { - spa_list_for_each(other, &control->inputs, inputs_link) + spa_list_for_each_safe(other, tmp, &control->inputs, inputs_link) pw_control_unlink(control, other); } else {