[cairo] reference counting vs garbage collection
Carl Worth
cworth at cworth.org
Tue Jan 4 19:13:47 PST 2005
On Tue, 04 Jan 2005 15:23:36 -0800, Keith Packard wrote:
> I like the cairo_surface_close idea quite a lot; if there aren't huge
> complaints, I will look into implementing it.
I've just gone back through the whole thread again, and I do like this
idea much more than a callback-based approach. So, please take a shot
at an implementation.
As for naming, I don't like "close" in the absence of any matching
"open".
It seems that any code that would be calling cairo_surface_close would
immediately be following it up with cairo_surface_destroy, (since the
surface is useless after that). And letting the user hold on to a
useless object doesn't seem like a feature to me.
So, why don't we merge the close functionality into "destroy"?
If we did that, then I think all we'd need is a new function to
replace current calls to surface_destroy that really just want to
release a reference. Perhaps cairo_surface_unreference?
Hey, look at that, two pairs of balanced calls:
cairo_surface_create
cairo_surface_reference
cairo_surface_unreference
cairo_surface_destroy
That seems not undesirable.
-Carl
More information about the cairo
mailing list