power: Use g_signal_connect_object

Objects created using the object storage API are not disposed when the panel
that created them is disposed. In order to prevent segfaults we need to manually
disconnect signal handler connected to these objects or we can do it
automatically using g_signal_connect_object.

Fixes: https://launchpad.net/bugs/1797205
This commit is contained in:
Andrea Azzarone 2018-10-10 20:10:27 +01:00
parent 6ce1a1dce6
commit f34ea2bd5e

View file

@ -1717,8 +1717,9 @@ iio_proxy_appeared_cb (GDBusConnection *connection,
return;
}
g_signal_connect_swapped (G_OBJECT (self->iio_proxy), "g-properties-changed",
G_CALLBACK (als_enabled_state_changed), self);
g_signal_connect_object (G_OBJECT (self->iio_proxy), "g-properties-changed",
G_CALLBACK (als_enabled_state_changed), self,
G_CONNECT_SWAPPED);
als_enabled_state_changed (self);
}