[cairo] reference counting vs garbage collection

Owen Taylor otaylor at redhat.com
Mon Jan 3 10:44:30 PST 2005


On Sun, 2005-01-02 at 12:37 -0800, Keith Packard wrote:
> In my nickle binding, I'm creating garbage collected objects that wrap 
> cairo surfaces and contexts.  This allows me to automatically destroy 
> surfaces which are no longer in use.
> 
> Cairo doesn't make this easy for some kinds of surfaces though; for png 
> and ps surfaces, there is a 'FILE' object which is referenced by these 
> surfaces and which must be fclose'd when the surface is finally destroyed.

Maybe the interface to these functions is just wrong? Why don't we
just have:

 cairo_image_surface_create()
 [...]
 cairo_image_surface_save_png()

Regards,
						Owen


(And maybe that should take a filename not a FILE *? 

FILE * is sort of an uncomfortable compromise ... its less convenient
than a 
filename, and far from perfectly general. I can't use a FILE * to save
to a 
gnome-vfs or kio URI, etc.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050103/2fd844b7/attachment.pgp


More information about the cairo mailing list