mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-17 07:00:03 -05:00
control: safely iterate the list, unlink modifies the list
This commit is contained in:
parent
1b2e73de0c
commit
6d569b132f
1 changed files with 2 additions and 2 deletions
|
|
@ -85,14 +85,14 @@ pw_control_new(struct pw_core *core,
|
||||||
void pw_control_destroy(struct pw_control *control)
|
void pw_control_destroy(struct pw_control *control)
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(control, struct impl, this);
|
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);
|
pw_log_debug("control %p: destroy", control);
|
||||||
|
|
||||||
spa_hook_list_call(&control->listener_list, struct pw_control_events, destroy);
|
spa_hook_list_call(&control->listener_list, struct pw_control_events, destroy);
|
||||||
|
|
||||||
if (control->direction == SPA_DIRECTION_OUTPUT) {
|
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);
|
pw_control_unlink(control, other);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue