[cairo] pixman crash from setting clip region on image surface
Peter Dennis Bartok
peter at novonyx.com
Fri May 14 15:03:04 PDT 2004
Hm,
I think there's a bug in the patch. Don't you want to send rcopy instead
of region to pixman_image_set_clip_region()?
Also, AFAIK region can be passed in as NULL in which case we'd not want
a copy generated but simply pass the NULL region onto pixman to destroy
the existing clip.
I've attached a patch that takes this into consideration.
Cheers,
Peter
vladimir at pobox.com wrote:
> 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
>
>
>
> ------------------------------------------------------------------------
>
> 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;
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://cairographics.org/cgi-bin/mailman/listinfo/cairo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image_surface_clip.patch
Type: text/x-patch
Size: 1029 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20040514/eb231695/image_surface_clip.bin
More information about the cairo
mailing list