[cairo-image-surface] Check for errors whilst cloning.

After attempting to clone an image, check the context status and return
the nil surface if there was an error.
This commit is contained in:
Chris Wilson 2007-10-04 19:20:35 +01:00
parent b61931640d
commit 8fb40aee97

View file

@ -1354,6 +1354,7 @@ _cairo_image_surface_clone (cairo_image_surface_t *surface,
cairo_format_t format)
{
cairo_image_surface_t *clone;
cairo_status_t status;
cairo_t *cr;
double x, y;
@ -1369,7 +1370,13 @@ _cairo_image_surface_clone (cairo_image_surface_t *surface,
cairo_set_source_surface (cr, &surface->base, 0, 0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
status = cairo_status (cr);
cairo_destroy (cr);
if (status) {
cairo_surface_destroy (&clone->base);
return (cairo_image_surface_t *) &_cairo_surface_nil;
}
return clone;
}