Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/display-channel.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/server/display-channel.c b/server/display-channel.c index cf019fe..c4d07f7 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -968,15 +968,15 @@ static void draw_depend_on_me(DisplayChannel *display, RedSurface *surface) static int validate_drawable_bbox(DisplayChannel *display, RedDrawable *drawable) { DrawContext *context; - uint32_t surface_id = drawable->surface_id; /* surface_id must be validated before calling into * validate_drawable_bbox */ - if (!display_channel_validate_surface(display, drawable->surface_id)) { + RedSurface *surface = display_channel_validate_surface(display, drawable->surface_id); + if (!surface) { return FALSE; } - context = &display->priv->surfaces[surface_id].context; + context = &surface->context; if (drawable->bbox.top < 0) return FALSE; @@ -1687,12 +1687,11 @@ void display_channel_update(DisplayChannel *display, QXLRect **qxl_dirty_rects, uint32_t *num_dirty_rects) { SpiceRect rect; - RedSurface *surface; + RedSurface *surface = display_channel_validate_surface(display, surface_id); - spice_return_if_fail(display_channel_validate_surface(display, surface_id)); + spice_return_if_fail(surface); red_get_rect_ptr(&rect, area); - surface = &display->priv->surfaces[surface_id]; display_channel_surface_draw(display, surface, &rect); if (*qxl_dirty_rects == NULL) { @@ -1732,11 +1731,10 @@ static void display_channel_destroy_surface(DisplayChannel *display, RedSurface void display_channel_destroy_surface_wait(DisplayChannel *display, uint32_t surface_id) { - if (!display_channel_validate_surface(display, surface_id)) - return; - RedSurface *surface = &display->priv->surfaces[surface_id]; - if (!surface->context.canvas) + RedSurface *surface = display_channel_validate_surface(display, surface_id); + if (!surface) { return; + } draw_depend_on_me(display, surface); /* note that draw_depend_on_me must be called before current_remove_all. -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel