]> code.delx.au - pulseaudio/commitdiff
bluetooth: Add hook to tell transport was removed
authorMikel Astiz <mikel.astiz@bmw-carit.de>
Fri, 19 Oct 2012 08:11:25 +0000 (10:11 +0200)
committerTanu Kaskinen <tanuk@iki.fi>
Fri, 19 Oct 2012 15:27:04 +0000 (18:27 +0300)
Add a hook to report that the transport was removed from D-Bus, and thus
references to it should be released.

src/modules/bluetooth/bluetooth-util.c
src/modules/bluetooth/bluetooth-util.h

index 0482c162926a7099cae18d6ad84d8146e141976a..f4f60c4a8fe47d5312d2584aa7eebab356aeb8f5 100644 (file)
@@ -157,8 +157,10 @@ static void device_free(pa_bluetooth_device *d) {
 
     pa_assert(d);
 
-    while ((t = pa_hashmap_steal_first(d->transports)))
+    while ((t = pa_hashmap_steal_first(d->transports))) {
+        pa_hook_fire(&t->hooks[PA_BLUETOOTH_TRANSPORT_HOOK_REMOVED], NULL);
         transport_free(t);
+    }
 
     pa_hashmap_free(d->transports, NULL, NULL);
 
@@ -1188,6 +1190,7 @@ static DBusMessage *endpoint_clear_configuration(DBusConnection *c, DBusMessage
         if ((t = pa_hashmap_get(d->transports, path))) {
             pa_log_debug("Clearing transport %s profile %d", t->path, t->profile);
             pa_hashmap_remove(d->transports, t->path);
+            pa_hook_fire(&t->hooks[PA_BLUETOOTH_TRANSPORT_HOOK_REMOVED], NULL);
             transport_free(t);
             break;
         }
index 879b3a3654bf4df4ee48be32fd8878ed29a1c9de..e52989142290dc0f04f3adec5dd23204e5a5d67c 100644 (file)
@@ -66,6 +66,7 @@ enum profile {
 /* Hook data: pa_bluetooth_transport pointer. */
 typedef enum pa_bluetooth_transport_hook {
     PA_BLUETOOTH_TRANSPORT_HOOK_NREC_CHANGED, /* Call data: NULL. */
+    PA_BLUETOOTH_TRANSPORT_HOOK_REMOVED, /* Call data: NULL. */
     PA_BLUETOOTH_TRANSPORT_HOOK_MAX
 } pa_bluetooth_transport_hook_t;