From f39f9b207b29311682ccc68e5621f3adba46322c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 28 Oct 2021 09:34:36 +0200 Subject: [PATCH] map: don't mix insert_at() and _remove() You are supposed to allocate with _insert_new()/_remove() or use someone elses allocated number with _insert_at(), never mix the two or it will give an error. --- src/pipewire/impl-port.c | 4 ++-- src/tools/pw-cli.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pipewire/impl-port.c b/src/pipewire/impl-port.c index faddedd52..f39a1d90c 100644 --- a/src/pipewire/impl-port.c +++ b/src/pipewire/impl-port.c @@ -1067,10 +1067,10 @@ static void pw_impl_port_remove(struct pw_impl_port *port) } if (port->direction == PW_DIRECTION_INPUT) { - pw_map_remove(&node->input_port_map, port->port_id); + pw_map_insert_at(&node->input_port_map, port->port_id, NULL); node->info.n_input_ports--; } else { - pw_map_remove(&node->output_port_map, port->port_id); + pw_map_insert_at(&node->output_port_map, port->port_id, NULL); node->info.n_output_ports--; } diff --git a/src/tools/pw-cli.c b/src/tools/pw-cli.c index 7cf75a072..c67e52ed5 100644 --- a/src/tools/pw-cli.c +++ b/src/tools/pw-cli.c @@ -369,7 +369,7 @@ static int destroy_global(void *obj, void *data) if (global == NULL) return 0; - pw_map_remove(&global->rd->globals, global->id); + pw_map_insert_at(&global->rd->globals, global->id, NULL); pw_properties_free(global->properties); free(global->type); free(global);