From 3c4e0f0f1a338fbbd802cdb3b65b8ea3abc758d1 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Mon, 12 Aug 2013 15:59:18 +0200 Subject: [PATCH] push_group: Refuse working with unusable surface Make cairo_push_group() fail when the context's target surface is finished. This fixes the api-special-cases for the xcb backend: Detected error during xcb run: error=9, seqno=0x13c, major=53, minor=0 The problem was that the Pixmap for the cairo surface was already freed and cairo still tried to use it again as the drawable in a CreatePixmap request. Signed-off-by: Uli Schlachter Reviewed-by: Chris Wilson --- src/cairo-default-context.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cairo-default-context.c b/src/cairo-default-context.c index fee08f088..aec5b10c4 100644 --- a/src/cairo-default-context.c +++ b/src/cairo-default-context.c @@ -153,6 +153,11 @@ _cairo_default_context_push_group (void *abstract_cr, cairo_content_t content) parent_surface = _cairo_gstate_get_target (cr->gstate); + if (unlikely (parent_surface->status)) + return parent_surface->status; + if (unlikely (parent_surface->finished)) + return _cairo_error (CAIRO_STATUS_SURFACE_FINISHED); + /* Get the extents that we'll use in creating our new group surface */ bounded = _cairo_surface_get_extents (parent_surface, &extents); if (clip)