Bug 671064 - Work around bug in Cairo 1.10 that causes Print Preview to crash. r=jmuizelaar
authorSteven Michaud <smichaud@pobox.com>
Tue, 02 Aug 2011 12:30:42 +0200
changeset 73697 0cdcf876dd05b21bf64b16f2c5323d4af591fabc
parent 73664 10927265c5558da7d729fa86fba3237f2eb2125c
child 73698 49f809c8038457c583657f27955552b4e3ad0ea3
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersjmuizelaar
bugs671064
milestone8.0a1
Bug 671064 - Work around bug in Cairo 1.10 that causes Print Preview to crash. r=jmuizelaar
gfx/cairo/cairo/src/cairo-quartz-surface.c
--- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
+++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
@@ -1101,16 +1101,17 @@ typedef struct {
     void *image_extra;
 } quartz_source_image_t;
 
 static void
 DataProviderReleaseCallback (void *info, const void *data, size_t size)
 {
     quartz_source_image_t *source_img = info;
     _cairo_surface_release_source_image (source_img->surface, source_img->image_out, source_img->image_extra);
+    cairo_surface_destroy (source_img->surface);
     free (source_img);
 }
 
 static cairo_status_t
 _cairo_surface_to_cgimage (cairo_surface_t *source,
 			   CGImageRef *image_out)
 {
     cairo_status_t status;
@@ -1140,20 +1141,21 @@ static cairo_status_t
             }
 	}
     }
 
     source_img = malloc (sizeof (quartz_source_image_t));
     if (source_img == NULL)
 	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 
-    source_img->surface = source;
+    source_img->surface = cairo_surface_reference(source);
 
     status = _cairo_surface_acquire_source_image (source_img->surface, &source_img->image_out, &source_img->image_extra);
     if (status) {
+	cairo_surface_destroy (source_img->surface);
 	free (source_img);
 	return status;
     }
 
     if (source_img->image_out->width == 0 || source_img->image_out->height == 0) {
 	*image_out = NULL;
 	DataProviderReleaseCallback (source_img,
 				     source_img->image_out->data,