[PATCH 12/13] bluetooth: Fix thread teardown code ordering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2013-02-13 at 08:40 +0100, Mikel Astiz wrote:
> Hi Tanu,
> 
> On Tue, Feb 12, 2013 at 8:37 PM, Tanu Kaskinen <tanuk at iki.fi> wrote:
> > 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.
> > ---
> >  src/modules/bluetooth/module-bluetooth-device.c |   14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
> > index f6f6da6..06fe0be 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;
> > --
> > 1.7.10.4
> 
> This one looks good to me.

Ok, I'll push this. Thanks for checking!

-- 
Tanu



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux