[cairo] bindings & memory management

Tamas K Papp tpapp at Princeton.EDU
Tue May 15 08:32:00 PDT 2007


I am writing Common Lisp bindings for cairo (cl-cairo appears to be
dormant and no longer compiles).  As suggested in the manual, I don't
want to expose the users to pointers and reference counts, but I don't
know what's the best model for that.

Currently I am wrapping a class around cairo objects like cairo_t,
which only contain a pointer, but I am not sure when I can destroy


1. surface is created, stored in a class
2. context is created from surface, stored in a class
3. can I destroy the surface now? My assumption is that the context is
still referencing it, but that's ok for me, I just no longer need the
surface explicitly.
4. when I am done with drawing on the context, can I just destroy the
context and have the surface destroyed automatically?

Another quesion: when is the output "flushed", for example, for a PDF
file -- when I destroy the context or when I destroy the surface?



More information about the cairo mailing list