mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-01-05 01:40:12 +01:00
dbus: fix crash when trying to reconnect
When coming from on_sync_reconnect, data points to the WpDBus object instead of the activation transition. Fixes: #305
This commit is contained in:
parent
aee4fe2579
commit
eb406bdb2c
1 changed files with 16 additions and 4 deletions
|
|
@ -58,14 +58,26 @@ wp_dbus_set_state (WpDbus *self, WpDBusState new_state)
|
|||
static void
|
||||
on_got_bus (GObject * obj, GAsyncResult * res, gpointer data)
|
||||
{
|
||||
WpTransition *transition = WP_TRANSITION (data);
|
||||
WpDbus *self = wp_transition_get_source_object (transition);
|
||||
WpTransition *transition;
|
||||
WpDbus *self;
|
||||
g_autoptr (GError) error = NULL;
|
||||
|
||||
if (WP_IS_TRANSITION (data)) {
|
||||
// coming from wp_dbus_enable
|
||||
transition = WP_TRANSITION (data);
|
||||
self = wp_transition_get_source_object (transition);
|
||||
} else {
|
||||
// coming from on_sync_reconnect
|
||||
transition = NULL;
|
||||
self = WP_DBUS (data);
|
||||
}
|
||||
|
||||
self->connection = g_dbus_connection_new_for_address_finish (res, &error);
|
||||
if (!self->connection) {
|
||||
g_prefix_error (&error, "Failed to connect to bus: ");
|
||||
wp_transition_return_error (transition, g_steal_pointer (&error));
|
||||
if (transition) {
|
||||
g_prefix_error (&error, "Failed to connect to bus: ");
|
||||
wp_transition_return_error (transition, g_steal_pointer (&error));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue