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

Victor Toso victortoso at redhat.com
Wed Jun 3 00:46:41 PDT 2015


Hi,

> > +static GList *
> > +set_all_sources_ready (GList *sources)
> > +{
> > +    GList *it = sources;
> > +    while (it != NULL) {
> > +        GSource *s = it->data;
> > +        GList *next = it->next;
> > +
> > +        if (s == NULL || g_source_is_destroyed(s)) {
> > +            /* remove */
> > +            sources = g_list_delete_link(sources, it);
> > +            g_clear_pointer(&s, g_source_unref);
> > +        } else {
> > +            /* dispatch */
> > +            g_source_set_ready_time(s, 0);
> > +        }
> > +        it = next;
> > +    }
> > +    return sources;
> > +}
> > +
> >  static void
> >  pipe_input_stream_check_source (PipeInputStream *self)
> >  {
> > -    if (self->source && !g_source_is_destroyed(self->source) &&
> > +    GSource *source;
> > +
> > +    if (self->sources == NULL)
> > +        return;
> > +
> > +    source = self->sources->data;
> > +    if (source && !g_source_is_destroyed(source) &&
> >          g_pollable_input_stream_is_readable(G_POLLABLE_INPUT_STREAM(self)))
> > -        g_source_set_ready_time(self->source, 0);
> > +        self->sources = set_all_sources_ready(self->sources);
>
> No idea why you check the first source here. I think the function could be just like:
>
> if (g_pollable_input_stream_is_readable(G_POLLABLE_INPUT_STREAM(self)))
>    self->sources = set_all_sources_ready(self->sources)
>

That's true. I'll try to be more careful. Do you want a new version or
the patch (with this change) is in acceptable state?

Thanks,

> > @@ -330,9 +347,14 @@ pipe_output_stream_dispose(GObject *object)
> >  static void
> >  pipe_output_stream_check_source (PipeOutputStream *self)
> >  {
> > -    if (self->source && !g_source_is_destroyed(self->source) &&
> > +    GSource * source;
> > +    if (self->sources == NULL)
> > +        return;
> > +
> > +    source = self->sources->data;
> > +    if (source && !g_source_is_destroyed(source) &&
> >          g_pollable_output_stream_is_writable(G_POLLABLE_OUTPUT_STREAM(self)))
> > -        g_source_set_ready_time(self->source, 0);
> > +        self->sources = set_all_sources_ready(self->sources);
>
> same here

I"ll change as well!


More information about the Spice-devel mailing list