From b6dd422dd2a2d31e33353164d7acff83b310748a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Mon, 3 Jan 2022 14:39:15 +0100 Subject: [PATCH] si-audio-adapter: Reference WpTransition before passing it as callback data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure to always have a valid WpTransition when used in the finish callback. Signed-off-by: Corentin Noël --- modules/module-si-audio-adapter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/module-si-audio-adapter.c b/modules/module-si-audio-adapter.c index 855a8170..f1f62185 100644 --- a/modules/module-si-audio-adapter.c +++ b/modules/module-si-audio-adapter.c @@ -430,10 +430,13 @@ build_adapter_default_format (WpSiAudioAdapter * self, const gchar *mode) static void on_format_set (GObject *obj, GAsyncResult * res, gpointer p) { - WpTransition *transition = p; + g_autoptr(WpTransition) transition = p; WpSiAudioAdapter *self = wp_transition_get_source_object (transition); g_autoptr (GError) error = NULL; + if (wp_transition_get_completed (transition)) + return; + wp_si_adapter_set_ports_format_finish (WP_SI_ADAPTER (self), res, &error); if (error) { wp_transition_return_error (transition, g_steal_pointer (&error)); @@ -474,7 +477,7 @@ si_audio_adapter_configure_node (WpSiAudioAdapter *self, /* set chosen format in the ports */ wp_si_adapter_set_ports_format (WP_SI_ADAPTER (self), - wp_spa_pod_ref (ports_format), mode, on_format_set, transition); + g_steal_pointer (&ports_format), mode, on_format_set, g_object_ref (transition)); } static void