diff options
author | Simon McVittie <smcv@debian.org> | 2019-08-13 15:53:49 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2019-08-18 15:01:45 +0100 |
commit | 9c94e30c70f64fc0c067e2225f82d88f31e3dca3 (patch) | |
tree | 06b95bfdc54faa9df84d189a3873955ba7454047 /lib/bluetooth-client.c | |
parent | 58f44f61296debebeb0a87c68e4737239254b2a3 (diff) | |
download | gnome-bluetooth-9c94e30c70f64fc0c067e2225f82d88f31e3dca3.tar.gz |
client: Disconnect all signal handlers when client is disposed
I've encountered an intermittent GNOME Shell crash when needrestart[1]
is allowed to restart system services that are using outdated shared
libraries, which sometimes includes BlueZ. The crash seems to involve
signals being delivered to a freed BluetoothClient, which can be avoided
by using g_signal_connect_object(). I haven't encountered the crash
since applying this change, although since it was always intermittent
I cannot be sure that it is fully solved.
This might be caused by using the Bluetooth Quick Connect shell
extension[2], which will create and destroy a BluetoothClient when the
extension is loaded and unloaded, which will in turn happen when the
screen is locked (due to extensions being disabled in the lock screen).
[1] https://github.com/liske/needrestart
[2] https://extensions.gnome.org/extension/1401/bluetooth-quick-connect/
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug-Debian: https://bugs.debian.org/932405
Diffstat (limited to 'lib/bluetooth-client.c')
-rw-r--r-- | lib/bluetooth-client.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c index bb4dc3ea..089fbb5f 100644 --- a/lib/bluetooth-client.c +++ b/lib/bluetooth-client.c @@ -392,8 +392,8 @@ device_added (GDBusObjectManager *manager, BluetoothType type; GtkTreeIter iter, parent; - g_signal_connect (G_OBJECT (device), "notify", - G_CALLBACK (device_notify_cb), client); + g_signal_connect_object (G_OBJECT (device), "notify", + G_CALLBACK (device_notify_cb), client, 0); adapter_path = device1_get_adapter (device); address = device1_get_address (device); @@ -608,8 +608,8 @@ adapter_added (GDBusObjectManager *manager, const gchar *address, *name; gboolean discovering, discoverable, powered; - g_signal_connect (G_OBJECT (adapter), "notify", - G_CALLBACK (adapter_notify_cb), client); + g_signal_connect_object (G_OBJECT (adapter), "notify", + G_CALLBACK (adapter_notify_cb), client, 0); address = adapter1_get_address (adapter); name = adapter1_get_name (adapter); @@ -798,11 +798,11 @@ object_manager_new_callback(GObject *source_object, priv = BLUETOOTH_CLIENT_GET_PRIVATE(client); priv->manager = manager; - g_signal_connect (G_OBJECT (priv->manager), "interface-added", (GCallback) interface_added, client); - g_signal_connect (G_OBJECT (priv->manager), "interface-removed", (GCallback) interface_removed, client); + g_signal_connect_object (G_OBJECT (priv->manager), "interface-added", (GCallback) interface_added, client, 0); + g_signal_connect_object (G_OBJECT (priv->manager), "interface-removed", (GCallback) interface_removed, client, 0); - g_signal_connect (G_OBJECT (priv->manager), "object-added", (GCallback) object_added, client); - g_signal_connect (G_OBJECT (priv->manager), "object-removed", (GCallback) object_removed, client); + g_signal_connect_object (G_OBJECT (priv->manager), "object-added", (GCallback) object_added, client, 0); + g_signal_connect_object (G_OBJECT (priv->manager), "object-removed", (GCallback) object_removed, client, 0); object_list = g_dbus_object_manager_get_objects (priv->manager); |