From 413ec4b708a511eb2f3866165a35d3a8d97bd326 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 22 Jun 2010 23:19:32 +0200 Subject: [PATCH] gl: Return a surface from _cairo_surface_create_in_error() On error, surface creation functions should always return a surface created with _cairo_surface_create_in_error() instead of a new surface in an error state. This simplifies internal code as no refcounting has to be done. --- src/cairo-gl-surface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c index 6755955e4..a36d7b7a4 100644 --- a/src/cairo-gl-surface.c +++ b/src/cairo-gl-surface.c @@ -339,7 +339,8 @@ cairo_gl_surface_create (cairo_device_t *abstract_device, _cairo_gl_surface_create_scratch (ctx, content, width, height); if (unlikely (surface->base.status)) { status = _cairo_gl_context_release (ctx, surface->base.status); - return &surface->base; + cairo_surface_destroy (&surface->base); + return _cairo_surface_create_in_error (status); } /* Cairo surfaces start out initialized to transparent (black) */