[PATCH 1/2] port-serial: allow completions not in idle

Dan Williams dcbw at redhat.com
Thu Mar 10 17:55:26 UTC 2016


On Thu, 2016-03-10 at 17:47 +0100, Aleksander Morgado wrote:
> On Thu, Mar 10, 2016 at 5:02 PM, Dan Williams <dcbw at redhat.com>
> wrote:
> > 
> > > 
> > > In addition to the problems with the references, we also update
> > > the
> > > common_input_available() method so that the source isn't kept if
> > > the last
> > > response buffer processing ended up closing the port.
> > > 
> > I had a comment about the common_input_available() change to return
> > G_SOURCE_REMOVE being redundant (since it only does this when the
> > source is already removed) but the code is OK as-is.  LGTM.
> The thing I saw is that if the port was being closed as a result of a
> response processing within common_input_available(), we were calling
> g_source_remove() for the GSource associated with
> common_input_available(), and then we were returning
> TRUE/G_SOURCE_CONTINUE on that same GSource, which looks like it was
> re-adding the GSource as valid again back in the loop (and that would
> crash if more data was arrived and the port was already unref-ed).
> Not
> sure if that change is the one you're referring to.

Yeah, that's what I was referring to.  I didn't think glib would do
that if the source was already destroyed, but if it does re-add it then
clearly common_input_available() needs to return G_SOURCE_REMOVE like
your patch does.  So OK from me.

Dan


More information about the ModemManager-devel mailing list