[pulseaudio-discuss] [PATCH v2 07/22] bluetooth: Fix check if transport exists before acquire

Mikel Astiz mikel.astiz.oss at gmail.com
Fri Aug 31 03:50:59 PDT 2012


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

The transport might have disapeared exactly before acquiring, so we
should avoid an assertion failure, in this case inside the function
pa_bluetooth_discovery_get_by_path().
---
 src/modules/bluetooth/module-bluetooth-device.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 46ab974..89bbbae 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -326,6 +326,11 @@ static int bt_transport_acquire(struct userdata *u, pa_bool_t start) {
     const char *accesstype = "rw";
     const pa_bluetooth_transport *t;
 
+    if (u->transport == NULL) {
+        pa_log("Transport no longer available.");
+        return -1;
+    }
+
     if (bt_transport_is_acquired(u)) {
         if (start)
             goto done;
-- 
1.7.7.6



More information about the pulseaudio-discuss mailing list