summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-12-03 11:03:58 +0100
committerTanu Kaskinen <tanuk@iki.fi>2012-12-04 03:08:57 +0200
commit01435e613417258f35e406f1ab95042b1c48b832 (patch)
tree34a63d73dbb366c08044a6dbb9aadf7fd1588fef
parent1dcdb96ee5384d16644271233ff93dbdd2e6c158 (diff)
bluetooth: Do not setup stream before thread starts
bt_transport_acquire() might get called from the main thread, in case the IO thread hasn't been started yet. In this case, we should not call setup_stream() since this is going to be called in the beginning of thread_func().
-rw-r--r--src/modules/bluetooth/module-bluetooth-device.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 7d89f6ca..f8315e1e 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -426,6 +426,10 @@ static int bt_transport_acquire(struct userdata *u, pa_bool_t start) {
return 0;
done:
+ /* If thread is still about to start, the stream will be set up in the beginning of thread_func() */
+ if (u->thread == NULL)
+ return 0;
+
setup_stream(u);
return 0;