From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx> The function can return an error, so in that case the profile change should fail. --- src/modules/bluetooth/module-bluetooth-device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 5801885..18f9bf0 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -2143,7 +2143,6 @@ static int start_thread(struct userdata *u) { if (!(u->thread = pa_thread_new("bluetooth", thread_func, u))) { pa_log_error("Failed to create IO thread"); - stop_thread(u); return -1; } @@ -2234,7 +2233,8 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) { goto off; if (u->sink || u->source) - start_thread(u); + if (start_thread(u) < 0) + goto off; return 0; -- 1.7.11.7