[cairo-commit] src/cairo.c

Jeff Muizelaar jrmuizel at kemper.freedesktop.org
Wed Sep 12 20:18:23 PDT 2007


 src/cairo.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
diff-tree dca93eb76d64194f1325d7b941fa523da7801634 (from 5eae45c55b3cd240945cd225631c9c782f69b50f)
Author: Jeff Muizelaar <jeff at freiheit.infidigm.net>
Date:   Wed Sep 12 23:12:59 2007 -0400

    Fix theoretical NULL return from cairo_pop_group()
    
    This also makes the code more consistent as group_pattern always holds a valid
    pattern.

diff --git a/src/cairo.c b/src/cairo.c
index 371a343..ff052b5 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -549,11 +549,11 @@ cairo_pattern_t *
 cairo_pop_group (cairo_t *cr)
 {
     cairo_surface_t *group_surface, *parent_target;
-    cairo_pattern_t *group_pattern = NULL;
+    cairo_pattern_t *group_pattern = (cairo_pattern_t*) &_cairo_pattern_nil.base;
     cairo_matrix_t group_matrix;
 
     if (cr->status)
-	return (cairo_pattern_t*) &_cairo_pattern_nil.base;
+	return group_pattern;
 
     /* Grab the active surfaces */
     group_surface = _cairo_gstate_get_target (cr->gstate);
@@ -562,7 +562,7 @@ cairo_pop_group (cairo_t *cr)
     /* Verify that we are at the right nesting level */
     if (parent_target == NULL) {
 	_cairo_set_error (cr, CAIRO_STATUS_INVALID_POP_GROUP);
-	return (cairo_pattern_t*) &_cairo_pattern_nil.base;
+	return group_pattern;
     }
 
     /* We need to save group_surface before we restore; we don't need


More information about the cairo-commit mailing list