summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2014-06-12 12:00:33 +0200
committerJiří Klimeš <jklimes@redhat.com>2014-06-12 13:52:45 +0200
commit948a27257a8f170fe1930eee7f0362a5b67c01b3 (patch)
treeb09dde304ad7381a650db62cbb5ef787d04a796d
parentc62639d5727c10692dbe267b802f69744db6a2db (diff)
downloadNetworkManager-948a27257a8f170fe1930eee7f0362a5b67c01b3.tar.gz
bluetooth: don't crash when switching off bluetooth (rh #1059494)
When connected to a phone via bluetooth and turning bluetooth off on the computer NetworkManegr crashed due to accessing invalid device. Reproducer: - activate bluetooth on a computer and a phone - pair the devices - $ nmcli con add type blue con-name phone bt-type panu addr 00:17:EA:84:E7:41 - turn off bluetooth on computer (either with a hardware or software switch) https://bugzilla.redhat.com/show_bug.cgi?id=1059494
-rw-r--r--src/devices/bluetooth/nm-bluez-device.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/devices/bluetooth/nm-bluez-device.c b/src/devices/bluetooth/nm-bluez-device.c
index e04e8d4dee..d81343b521 100644
--- a/src/devices/bluetooth/nm-bluez-device.c
+++ b/src/devices/bluetooth/nm-bluez-device.c
@@ -410,6 +410,8 @@ bluez_disconnect_cb (GDBusConnection *dbus_connection,
g_error_free (error);
} else
g_variant_unref (variant);
+
+ g_object_unref (NM_BLUEZ_DEVICE (user_data));
}
void
@@ -449,7 +451,7 @@ nm_bluez_device_disconnect (NMBluezDevice *self)
10000,
NULL,
(GAsyncReadyCallback) bluez_disconnect_cb,
- self);
+ g_object_ref (self));
priv->connection_bt_type = NM_BT_CAPABILITY_NONE;
}