[Spice-devel] [PATCH 11/11] worker: remove assertion on alloc_drawable

Frediano Ziglio fziglio at redhat.com
Thu Oct 29 13:24:27 PDT 2015


> 
> From: Marc-André Lureau <marcandre.lureau at gmail.com>
> 
> There is no guarantee in the code that this can't be hit, so we should
> cope with it (the condition can be reached easily by running the server
> without waiting for blocked clients or pipe size)
> 
> The following commit will attempt to address this.
> ---
>  server/red_worker.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 0542b29..ca7e8bf 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -3300,7 +3300,8 @@ static void free_one_drawable(RedWorker *worker, int
> force_glz_free)
>      Drawable *drawable;
>      Container *container;
>  
> -    spice_assert(ring_item);
> +    if (!ring_item)
> +        return;
>      drawable = SPICE_CONTAINEROF(ring_item, Drawable, list_link);
>      if (force_glz_free) {
>          RingItem *glz_item, *next_item;
> --
> 2.4.3
> 

The change make sense. The function is called from different places and not in all path
we are sure worker->current_list is not empty.

Style note: looks like we prefer always bracket like

if (!ring_item) {
    return;
}

Beside the style note I would ack the patch.

Frediano


More information about the Spice-devel mailing list