summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2013-09-19 14:08:31 +0200
committerThomas Haller <thaller@redhat.com>2013-09-25 21:01:04 +0200
commitdc85b22e0aaa6b89d256dd31a20132fe45743a60 (patch)
tree33e80cb025aac78290d083c093c15df0ce791890
parentbda25894ea913f6344ebf3dbdb4fee1c63be0d26 (diff)
downloadNetworkManager-dc85b22e0aaa6b89d256dd31a20132fe45743a60.tar.gz
bluez: take reference for device before creating dbus adapter
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--src/bluez-manager/nm-bluez-device.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/bluez-manager/nm-bluez-device.c b/src/bluez-manager/nm-bluez-device.c
index 0da51b7257..3be7dfd85d 100644
--- a/src/bluez-manager/nm-bluez-device.c
+++ b/src/bluez-manager/nm-bluez-device.c
@@ -513,10 +513,10 @@ on_adapter_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self)
if (!priv->adapter) {
nm_log_warn (LOGD_BT, "failed to acquire adapter proxy: %s.", error->message);
g_clear_error (&error);
- return;
- }
+ } else
+ check_emit_usable (self);
- check_emit_usable (self);
+ g_object_unref (self);
}
static void
@@ -657,6 +657,7 @@ query_properties (NMBluezDevice *self)
v = g_dbus_proxy_get_cached_property (priv->proxy5, "Adapter");
if (v) {
+ g_object_ref (self);
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
@@ -759,13 +760,13 @@ on_proxy_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self)
nm_log_warn (LOGD_BT, "failed to acquire device proxy: %s.", error->message);
g_clear_error (&error);
g_signal_emit (self, signals[INITIALIZED], 0, FALSE);
- return;
- }
-
- g_signal_connect (priv->proxy5, "g-properties-changed",
- G_CALLBACK (properties_changed), self);
+ } else {
+ g_signal_connect (priv->proxy5, "g-properties-changed",
+ G_CALLBACK (properties_changed), self);
- query_properties (self);
+ query_properties (self);
+ }
+ g_object_unref (self);
}
static void
@@ -821,6 +822,7 @@ nm_bluez_device_new (const char *path
(GAsyncReadyCallback) on_bus_acquired,
self);
+ g_object_ref (self);
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
NULL,