[cairo] Cairo 1.6.4 Quartz crash: CGImageCreateCopy misuse

Paul Messmer paulmessmer at hotmail.com
Mon May 5 21:56:10 PDT 2008

Yes, this fixes the problem for me (with a cast to make it compile and another to silence a warning):

    isurf_snap = (cairo_image_surface_t *) _cairo_surface_snapshot ((cairo_surface_t *) isurf);

And (as you said) every time I draw from a source image surface, even the same one repeatedly, I see copies being made now in _cairo_surface_fallback_snapshot.

This is problematic for me as I might be printing large images repeatedly on multiple pages, etc...  I've already kludged a work-around without the patch by not releasing my surface pointers until printing is complete, but that's clearly ugly (though then I never copy the data).  I assume you meant I should look into using the experimental *quartz-*cairo-image-surface? which I will investigate when I have more time.  Hopefully in the long term a different fix than this patch is done in Cairo so that clients don't have to special-case Quartz printing to avoid copies for each painting of a single image surface.

Thanks much for the quick replies,
-- Paul

> CC: paulmessmer at hotmail.com; cairo at cairographics.org
> From: vladimir at pobox.com
> To: vladimir at pobox.com
> Subject: Re: [cairo] Cairo 1.6.4 Quartz crash: CGImageCreateCopy misuse
> Date: Mon, 5 May 2008 13:00:57 -0700
> Paul,
> Can you try the attached patch and see if it fixes the problem for  
> you?  Note that in most cases this will result in a copy of the image  
> data being created -- to avoid this, you should use the (experimental)  
> cairo-image-surface and have it backed by an image surface that owns  
> its own data.  That way the lifecycle issues are handled via  
> refcounting, and no copy is needed.
>      - Vlad

More information about the cairo mailing list