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 <psychon@znc.in>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Uli Schlachter 2013-08-12 15:59:18 +02:00
parent 18633b0810
commit 3c4e0f0f1a

View file

@ -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)