[Spice-devel] [PATCH 01/10] worker: don't process drawable if it can't be allocated

Frediano Ziglio fziglio at redhat.com
Thu Nov 5 03:17:01 PST 2015


> 
> On Thu, Nov 5, 2015 at 10:14 AM, Frediano Ziglio <fziglio at redhat.com> wrote:
> > ---
> >  server/red_worker.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/server/red_worker.c b/server/red_worker.c
> > index 1c37dc0..821ea75 100644
> > --- a/server/red_worker.c
> > +++ b/server/red_worker.c
> > @@ -3213,14 +3213,14 @@ static inline int red_handle_self_bitmap(RedWorker
> > *worker, Drawable *drawable)
> >      return TRUE;
> >  }
> >
> > -static void free_one_drawable(RedWorker *worker, int force_glz_free)
> > +static bool free_one_drawable(RedWorker *worker, int force_glz_free)
> >  {
> >      RingItem *ring_item = ring_get_tail(&worker->current_list);
> >      Drawable *drawable;
> >      Container *container;
> >
> >      if (!ring_item) {
> > -        return;
> > +        return FALSE;
> >      }
> >      drawable = SPICE_CONTAINEROF(ring_item, Drawable, list_link);
> >      if (force_glz_free) {
> > @@ -3235,6 +3235,8 @@ static void free_one_drawable(RedWorker *worker, int
> > force_glz_free)
> >
> >      current_remove_drawable(worker, drawable);
> >      container_cleanup(worker, container);
> > +
> > +    return TRUE;
> >  }
> >
> >  static Drawable *get_drawable(RedWorker *worker, uint8_t effect,
> >  RedDrawable *red_drawable,
> > @@ -3255,7 +3257,8 @@ static Drawable *get_drawable(RedWorker *worker,
> > uint8_t effect, RedDrawable *re
> >      }
> >
> >      while (!(drawable = alloc_drawable(worker))) {
> > -        free_one_drawable(worker, FALSE);
> > +        if (!free_one_drawable(worker, FALSE))
> > +            return NULL;
> >      }
> >      worker->drawable_count++;
> >      memset(drawable, 0, sizeof(Drawable));
> > @@ -3358,7 +3361,6 @@ static inline void red_process_draw(RedWorker
> > *worker, RedDrawable *red_drawable
> >      Drawable *drawable = get_drawable(worker, red_drawable->effect,
> >      red_drawable, group_id);
> >
> >      if (!drawable) {
> > -        rendering_incorrect("failed to get_drawable");
> >          return;
> >      }
> >
> > --
> > 2.4.3

> 
> Looks good to me, ACK.
> 

Merged

Frediano


More information about the Spice-devel mailing list