[Spice-devel] [spice-gtk PATCH v4 1/6] giopipe: don't fail on create_source

Marc-André Lureau mlureau at redhat.com
Tue Jun 2 09:32:40 PDT 2015



----- Original Message -----
> Hey, thanks for the quick review!
> 
> > >  static void
> > > +set_all_sources_ready (GList *sources)
> > > +{
> > > +    GList *it;
> > > +    for (it = sources; it != NULL; it = it->next) {
> > > +        GSource *s = it->data;
> > > +        if (s != NULL && !g_source_is_destroyed(s))
> > > +            g_source_set_ready_time(s, 0);
> > > +    }
> > > +    g_list_free_full (sources, (GDestroyNotify) g_source_unref);
> > > +}
> > > +
> > > +static void
> > >  pipe_input_stream_check_source (PipeInputStream *self)
> > >  {
> > >      if (self->source && !g_source_is_destroyed(self->source) &&
> > > -
> > > g_pollable_input_stream_is_readable(G_POLLABLE_INPUT_STREAM(self)))
> > > -        g_source_set_ready_time(self->source, 0);
> > > +
> > > g_pollable_input_stream_is_readable(G_POLLABLE_INPUT_STREAM(self))) {
> > > +        set_all_sources_ready(self->created_sources);
> > > +        self->created_sources = NULL;
> > > +        self->source = NULL;
> > >
> >
> > Why do you free the sources? Only the destroyed one should be enough. The
> > rest should still remain "dispatchable"
> 
> I unref all GSources because all of them should be destroyed or dispatched
> by g_source_set_ready_time in the set_all_sources_ready function above;


But if they are not yet destroyed, they should still be dispatched.


More information about the Spice-devel mailing list