si-standard-link: fix crash after returning a link error

If one link fails, the activation transition will return, but then
other links will continue to call the callback and try to access
the now invalid activation transition. With this change, the callback
is bound to the lifetime of the transition and will stop being called
after the transition returns

Fixes #76
This commit is contained in:
George Kiagiadakis 2021-10-16 09:51:00 +03:00
parent 9e11aa5b8b
commit 6e67000d5e

View file

@ -310,9 +310,10 @@ create_links (WpSiStandardLink * self, WpTransition * transition,
/* activate to ensure it is created without errors */
self->n_async_ops_wait++;
wp_object_activate (WP_OBJECT (link),
wp_object_activate_closure (WP_OBJECT (link),
WP_PIPEWIRE_OBJECT_FEATURES_MINIMAL, NULL,
(GAsyncReadyCallback) on_link_activated, transition);
g_cclosure_new_object (
(GCallback) on_link_activated, G_OBJECT (transition)));
}
g_variant_iter_free (iter);
return self->node_links->len > 0;