summaryrefslogtreecommitdiff
path: root/src/modules/bluetooth
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-09-08 13:35:33 +0300
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>2014-09-10 13:25:36 +0300
commit5c2ed8abedd55141101829c4b2069ad5aa5498f4 (patch)
tree7451330eb83340afd922041e63012f5921c69079 /src/modules/bluetooth
parentfcfaa77fe77a2e97d7ae56d0ee6bbb26201d87d7 (diff)
bluetooth: Only create backend instance once objects are listed
This makes sure the devices are discovered before the backend start creating new transports.
Diffstat (limited to 'src/modules/bluetooth')
-rw-r--r--src/modules/bluetooth/bluez5-util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
index efe87d348..97862d5e1 100644
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -895,6 +895,9 @@ static void get_managed_objects_reply(DBusPendingCall *pending, void *userdata)
y->objects_listed = true;
+ if (!y->backend)
+ y->backend = pa_bluetooth_backend_new(y->core);
+
finish:
dbus_message_unref(r);
@@ -947,6 +950,10 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
pa_hashmap_remove_all(y->devices);
pa_hashmap_remove_all(y->adapters);
y->objects_listed = false;
+ if (y->backend) {
+ pa_bluetooth_backend_free(y->backend);
+ y->backend = NULL;
+ }
}
if (new_owner && *new_owner) {
@@ -1597,7 +1604,6 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
endpoint_init(y, PA_BLUETOOTH_PROFILE_A2DP_SINK);
endpoint_init(y, PA_BLUETOOTH_PROFILE_A2DP_SOURCE);
- y->backend = pa_bluetooth_backend_new(c);
get_managed_objects(y);