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

(cherry picked from commit 948a27257a)
This commit is contained in:
Jiří Klimeš 2014-06-12 12:00:33 +02:00
parent aa1aa581e2
commit 063b2e7618

View file

@ -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;
}