thread_mq.outq may contain some unprocessed messages, which should be
dispatched before unreffing the sink and source. If the sink and
source are unreffed before all messages to them have been dispatched,
the unreffing won't free the sink and source, and that in turn will
likely cause problems with things getting freed in a wrong order.
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;
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;