si-audio-adapter: Reference WpTransition before passing it as callback data

Make sure to always have a valid WpTransition when used in the finish callback.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
This commit is contained in:
Corentin Noël 2022-01-03 14:39:15 +01:00
parent 6adccbe33d
commit b6dd422dd2

View file

@ -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