[cairo] Cleaning up the PDF API
krh at bitplanet.net
Mon May 16 11:49:12 PDT 2005
On Mon, 2005-05-16 at 10:39 -0700, Carl Worth wrote:
> On Mon, 16 May 2005 13:28:25 -0400, Kristian Høgsberg wrote:
> > We do have this two phases destruction on all surfaces. It's just that
> > in the stream based case, the underlying resource that we destroy going
> > from active to finished is user supplied and we don't know how to
> > destroy it - thus the callback.
> But could we move the user_data destruction to the active->finished
> transition? If so, it seems we could unify these two concepts and
> simplify things for the user.
No, the point is that as long as you hold a reference to the surface,
you should be able to get the user data you attached to it.
> Or does the user really care about the finished->destroyed transition?
The transition itself probably isn't interesting, but it is a nice
property that if you attach user data to a surface it's there until the
surface is destroyed. We could get rid of reference counting and the
two phase destroy convention and just destroy the surface on
active->finish. Users would be expected to update their surface
pointers (e.g. NULL them out or similar) once their user data was
destroyed. However, if we're not going in that direction, I think it's
better to keep the user data on the surface for it's entire life time.
More information about the cairo