[cairo-commit] src/cairo-gl-surface.c

Benjamin Otte company at kemper.freedesktop.org
Tue Jun 22 14:21:17 PDT 2010

 src/cairo-gl-surface.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 413ec4b708a511eb2f3866165a35d3a8d97bd326
Author: Benjamin Otte <otte at redhat.com>
Date:   Tue Jun 22 23:19:32 2010 +0200

    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.

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 6755955..a36d7b7 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) */

More information about the cairo-commit mailing list