[cairo] [PATCH] fix bugs 15797 (1.8) and 18632 (master)

Paolo Bonzini bonzini at gnu.org
Tue Dec 9 21:38:03 PST 2008


> Also, I'm a little frightened that keeping an implicit reference around
> will make it easy unintentionally reference a freed area of memory. It
> may be better to just make a copy of it. Aside: If allocation/free overhead is
> dominating, an object pool might be a better solution.

Yes, I thought about it for a while before doing it this way, but then
these functions appear just in a couple of possible call stacks.

One allocation might be okay because anyway the code is allocating
Quartz objects on the heap, but then why does Cairo use stack-allocated
objects in the first place?

Another possibility is to *always* copy the pattern to be
stack-allocated in cairo-gstate.c, and assert here that the reference
count is 0.

Paolo


More information about the cairo mailing list