From 60ed51008d46ddda3310673a6e42023a4abef958 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 1 Jul 2022 16:55:08 +0200 Subject: 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. --- audio/out/ao_pipewire.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'audio') diff --git a/audio/out/ao_pipewire.c b/audio/out/ao_pipewire.c index 316c4e58db..7dda0e1068 100644 --- a/audio/out/ao_pipewire.c +++ b/audio/out/ao_pipewire.c @@ -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); + spa_zero(core_listener); 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); 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_ctx = cb_ctx, }; + spa_zero(registry_listener); pw_registry_add_listener(registry, ®istry_listener, &for_each_sink_registry_events, &revents_ctx); pw_thread_loop_wait(priv->loop); -- cgit v1.2.3