[cairo] API Shakeup: cairo_output_stream_t and cairo_surface_finish()

Bill Spitzak spitzak at d2.com
Wed Feb 16 11:47:32 PST 2005



Kristian Høgsberg wrote:

> - cairo takes ownership of the cairo_output_stream_t when you create a 
> surface for the output stream, and frees it after calling the 
> destroy_func.  Maybe the solution is to just not do this, rename 
> destroy_func to finish_func, and let the user call 
> cairo_stream_destroy() either after calling cairo_surface_finish() or in 
> a user data destroy callback.

I think it is unlikely the caller wants to keep track of the 
cairo_stream_t object, since it can't do anything with it. They more 
likely want to keep track of the FILE or whatever object. So I see no 
problem with how this is working.

If they don't want the FILE closed, they don't have to make the 
destroy_func do that.

> - should we keep the cairo_output_stream_t object out of the public API
> entirely and make the user pass in write_func, destroy_func, and closure 
> as extra arguments to the surface create functions?

That kind of is the same question, and it might make sense. This way the 
cairo_stream_t is not exposed at all, so there is no questions about who 
owns it.



More information about the cairo mailing list