[cairo-commit] src/cairoint.h src/cairo-pattern.c src/cairo-recording-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Jun 11 13:10:13 PDT 2010


 src/cairo-pattern.c           |   17 -----------------
 src/cairo-recording-surface.c |   24 ++++++++++++------------
 src/cairoint.h                |    3 ---
 3 files changed, 12 insertions(+), 32 deletions(-)

New commits:
commit 00bc1d1578dc2640db64315270b00073697fb9fa
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jun 11 20:31:29 2010 +0100

    pattern: Remove extraordinary _cairo_pattern_fini_snapshot().
    
    Miraculously the circular references from self-copy have disappeared and
    the forced finish within _cairo_pattern_fini_snapshot() now quite
    explosive. By replacing them with an ordinary _cairo_pattern_fini() the
    crash from test/smask-image-mask disappear along and valgrind remains
    happy.
    
    Fixes test/smask-image-mask and similar.

diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index d91e5d5..c94e076 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -356,23 +356,6 @@ _cairo_pattern_fini (cairo_pattern_t *pattern)
 #endif
 }
 
-void
-_cairo_pattern_fini_snapshot (cairo_pattern_t *pattern)
-{
-    /* XXX this is quite ugly, but currently necessary to break the circular
-     * references with snapshot-cow and the recording-surface.
-     * This operation remains safe only whilst _cairo_surface_snapshot() is
-     * not public...
-     */
-    if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
-	cairo_surface_pattern_t *spat = (cairo_surface_pattern_t *) pattern;
-
-	cairo_surface_finish (spat->surface);
-    }
-
-    _cairo_pattern_fini (pattern);
-}
-
 cairo_status_t
 _cairo_pattern_create_copy (cairo_pattern_t	  **pattern_out,
 			    const cairo_pattern_t  *other)
diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index ab78dca..f7c501c 100644
--- a/src/cairo-recording-surface.c
+++ b/src/cairo-recording-surface.c
@@ -189,27 +189,27 @@ _cairo_recording_surface_finish (void *abstract_surface)
 
 	switch (command->header.type) {
 	case CAIRO_COMMAND_PAINT:
-	    _cairo_pattern_fini_snapshot (&command->paint.source.base);
+	    _cairo_pattern_fini (&command->paint.source.base);
 	    break;
 
 	case CAIRO_COMMAND_MASK:
-	    _cairo_pattern_fini_snapshot (&command->mask.source.base);
-	    _cairo_pattern_fini_snapshot (&command->mask.mask.base);
+	    _cairo_pattern_fini (&command->mask.source.base);
+	    _cairo_pattern_fini (&command->mask.mask.base);
 	    break;
 
 	case CAIRO_COMMAND_STROKE:
-	    _cairo_pattern_fini_snapshot (&command->stroke.source.base);
+	    _cairo_pattern_fini (&command->stroke.source.base);
 	    _cairo_path_fixed_fini (&command->stroke.path);
 	    _cairo_stroke_style_fini (&command->stroke.style);
 	    break;
 
 	case CAIRO_COMMAND_FILL:
-	    _cairo_pattern_fini_snapshot (&command->fill.source.base);
+	    _cairo_pattern_fini (&command->fill.source.base);
 	    _cairo_path_fixed_fini (&command->fill.path);
 	    break;
 
 	case CAIRO_COMMAND_SHOW_TEXT_GLYPHS:
-	    _cairo_pattern_fini_snapshot (&command->show_text_glyphs.source.base);
+	    _cairo_pattern_fini (&command->show_text_glyphs.source.base);
 	    free (command->show_text_glyphs.utf8);
 	    free (command->show_text_glyphs.glyphs);
 	    free (command->show_text_glyphs.clusters);
@@ -333,7 +333,7 @@ _cairo_recording_surface_paint (void			  *abstract_surface,
     return CAIRO_STATUS_SUCCESS;
 
   CLEANUP_SOURCE:
-    _cairo_pattern_fini_snapshot (&command->source.base);
+    _cairo_pattern_fini (&command->source.base);
   CLEANUP_COMMAND:
     _cairo_clip_fini (&command->header.clip);
     free (command);
@@ -375,9 +375,9 @@ _cairo_recording_surface_mask (void			*abstract_surface,
     return CAIRO_STATUS_SUCCESS;
 
   CLEANUP_MASK:
-    _cairo_pattern_fini_snapshot (&command->mask.base);
+    _cairo_pattern_fini (&command->mask.base);
   CLEANUP_SOURCE:
-    _cairo_pattern_fini_snapshot (&command->source.base);
+    _cairo_pattern_fini (&command->source.base);
   CLEANUP_COMMAND:
     _cairo_clip_fini (&command->header.clip);
     free (command);
@@ -437,7 +437,7 @@ _cairo_recording_surface_stroke (void			*abstract_surface,
   CLEANUP_PATH:
     _cairo_path_fixed_fini (&command->path);
   CLEANUP_SOURCE:
-    _cairo_pattern_fini_snapshot (&command->source.base);
+    _cairo_pattern_fini (&command->source.base);
   CLEANUP_COMMAND:
     _cairo_clip_fini (&command->header.clip);
     free (command);
@@ -488,7 +488,7 @@ _cairo_recording_surface_fill (void			*abstract_surface,
   CLEANUP_PATH:
     _cairo_path_fixed_fini (&command->path);
   CLEANUP_SOURCE:
-    _cairo_pattern_fini_snapshot (&command->source.base);
+    _cairo_pattern_fini (&command->source.base);
   CLEANUP_COMMAND:
     _cairo_clip_fini (&command->header.clip);
     free (command);
@@ -582,7 +582,7 @@ _cairo_recording_surface_show_text_glyphs (void				*abstract_surface,
     free (command->glyphs);
     free (command->clusters);
 
-    _cairo_pattern_fini_snapshot (&command->source.base);
+    _cairo_pattern_fini (&command->source.base);
   CLEANUP_COMMAND:
     _cairo_clip_fini (&command->header.clip);
     free (command);
diff --git a/src/cairoint.h b/src/cairoint.h
index e160c2b..014f0ba 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -2205,9 +2205,6 @@ _cairo_pattern_init_radial (cairo_radial_pattern_t *pattern,
 cairo_private void
 _cairo_pattern_fini (cairo_pattern_t *pattern);
 
-cairo_private void
-_cairo_pattern_fini_snapshot (cairo_pattern_t *pattern);
-
 cairo_private cairo_pattern_t *
 _cairo_pattern_create_solid (const cairo_color_t	*color);
 


More information about the cairo-commit mailing list