[cairo] Destroy a cairo_surface_t with bad status

Chris Wilson chris at chris-wilson.co.uk
Mon May 20 13:46:23 PDT 2013

On Mon, May 20, 2013 at 07:55:24PM +0200, Carlos López González wrote:
>    Hi!
>    When I request a cairo_surface_t* (say reading png from filename) and its
>    status is not null (i.e. file doesn't exists), how should I destroy the
>    bad status surface?
>    Is it ok to do not destroy it and just leave the system take care of the
>    stored pointer?

You treat it as a normal surface and so should call
cairo_surface_destroy() once you are finished with it. Only the surfaces
that in an error state from creation are static, if an error is raised
later it will require the normal cleanup.

Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list