[cairo] reference counting vs garbage collection

Kristian Høgsberg krh at bitplanet.net
Wed Jan 5 12:42:59 PST 2005


Keith Packard wrote:
> Around 14 o'clock on Jan 5, Kristian Høgsberg wrote:
> 
> 
>>The problem is that the FILE (or whatever resource) could be shared between
>>several surfaces.  When you call create_similar, the PDF backend creates a
>>new surface which references the same underlying FILE.
> 
> How can this work?  Is there synchronization between the set of surfaces 
> sharing the same FILE?  Do the similar surfaces reference the 'master' 
> surface?  If so, wouldn't they be effectively painting 'through' the 
> master surface and hence abide by it's 'closed' status?

They don't directly reference the FILE object, they reference the 
document object.  The document object holds the FILE pointer and records 
the pages currently generated.  The document also tracks which surface 
owns the current stream of drawing operators, and if you draw to a 
different surface, a new stream is created for that surface.

Kristian



More information about the cairo mailing list