diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 25a21821e..776bcbae4 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1954,6 +1954,13 @@ static void stop_thread(struct userdata *u) { u->rtpoll_item = NULL; } + if (u->rtpoll) { + pa_thread_mq_done(&u->thread_mq); + + pa_rtpoll_free(u->rtpoll); + u->rtpoll = NULL; + } + if (u->transport) { bt_transport_release(u); u->transport = NULL; @@ -1981,13 +1988,6 @@ static void stop_thread(struct userdata *u) { u->source = NULL; } - if (u->rtpoll) { - pa_thread_mq_done(&u->thread_mq); - - pa_rtpoll_free(u->rtpoll); - u->rtpoll = NULL; - } - if (u->read_smoother) { pa_smoother_free(u->read_smoother); u->read_smoother = NULL;