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

Victor Toso victortoso at redhat.com
Tue Jun 2 10:24:53 PDT 2015


On Tue, Jun 02, 2015 at 12:32:40PM -0400, Marc-André Lureau wrote:
> ----- 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.

set_all_sources_ready() dispatch all GSources that are no yet destroyed.
Do you mean that we should keep the reference until the source is
destroyed?


More information about the Spice-devel mailing list