[cairo] pixman crash from setting clip region on image surface (patch)

vladimir at pobox.com vladimir at pobox.com
Fri May 14 01:03:23 PDT 2004


Hi,

I've been using the attached patch with no ill effects, and I'm even
fairly convinced that it's not leaking regions... the copy that's
passed to image_set_clip is always kept by the gstate (or destroyed
right after), so it should be okay.

	- Vlad

-------------- next part --------------
Index: src/cairo_image_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_image_surface.c,v
retrieving revision 1.11
diff -u -u -r1.11 cairo_image_surface.c
--- src/cairo_image_surface.c	16 Apr 2004 15:33:20 -0000	1.11
+++ src/cairo_image_surface.c	14 May 2004 07:37:01 -0000
@@ -462,6 +462,11 @@
 _cairo_image_surface_set_clip_region (cairo_image_surface_t *surface,
 				      pixman_region16_t *region)
 {
+    pixman_region16_t *rcopy = pixman_region_create ();
+
+    /* pixman_image_set_clip_region expects to take ownership of the
+     * passed-in region, so we create a copy to give it. */
+    pixman_region_copy (rcopy, region);
     pixman_image_set_clip_region (surface->pixman_image, region);
 
     return CAIRO_STATUS_SUCCESS;


More information about the cairo mailing list