ao_pipewire: zero listeners

The listeners need to be cleared because removing them might invoke the
removed handler, which could otherwise point to invalid memory.
This commit is contained in:
Wim Taymans 2022-07-01 16:55:08 +02:00 committed by Philip Langdale
parent d38ff1c958
commit 60ed51008d
1 changed files with 2 additions and 0 deletions

View File

@ -307,6 +307,7 @@ static void for_each_sink(struct ao *ao, void (cb) (struct ao *ao, uint32_t id,
pw_thread_loop_lock(priv->loop); pw_thread_loop_lock(priv->loop);
spa_zero(core_listener);
pw_core_add_listener(priv->core, &core_listener, &for_each_sink_core_events, priv->loop); pw_core_add_listener(priv->core, &core_listener, &for_each_sink_core_events, priv->loop);
registry = pw_core_get_registry(priv->core, PW_VERSION_REGISTRY, 0); registry = pw_core_get_registry(priv->core, PW_VERSION_REGISTRY, 0);
pw_core_sync(priv->core, 0, 0); pw_core_sync(priv->core, 0, 0);
@ -317,6 +318,7 @@ static void for_each_sink(struct ao *ao, void (cb) (struct ao *ao, uint32_t id,
.sink_cb = cb, .sink_cb = cb,
.sink_cb_ctx = cb_ctx, .sink_cb_ctx = cb_ctx,
}; };
spa_zero(registry_listener);
pw_registry_add_listener(registry, &registry_listener, &for_each_sink_registry_events, &revents_ctx); pw_registry_add_listener(registry, &registry_listener, &for_each_sink_registry_events, &revents_ctx);
pw_thread_loop_wait(priv->loop); pw_thread_loop_wait(priv->loop);