[cairo-commit] src/cairo-pattern.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Jul 3 16:16:30 PDT 2008


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

New commits:
commit 1c729f85edf967d086eeb85b9222466087e70da4
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Jul 3 19:15:53 2008 -0400

    [cairo-pattern] Fix crash in solid-pattern-surface cache
    
    Ickle knew something when he only extended cache size when we are
    committed to inserting something into the cache.  I broke that while
    fixing other issues a while ago.  This cache just doesn't want to
    give us any rest...

diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 22cd69c..8fde845 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1478,10 +1478,6 @@ _cairo_pattern_acquire_surface_for_solid (cairo_solid_pattern_t	     *pattern,
 	    surface = NULL;
 	}
     }
-    else
-    {
-	i = solid_surface_cache.size++;
-    }
 
     if (surface == NULL) {
 	/* Not cached, need to create new */
@@ -1499,6 +1495,9 @@ _cairo_pattern_acquire_surface_for_solid (cairo_solid_pattern_t	     *pattern,
 	}
     }
 
+    if (i == solid_surface_cache.size)
+	solid_surface_cache.size++;
+
     to_destroy = solid_surface_cache.cache[i].surface;
     solid_surface_cache.cache[i].surface = surface;
     solid_surface_cache.cache[i].color   = pattern->color;


More information about the cairo-commit mailing list