[cairo] How to free the memory allocated
by cairo_image_surface_create_for_png?
Owen Taylor
otaylor at redhat.com
Tue Apr 5 06:53:10 PDT 2005
On Tue, 2005-04-05 at 09:52 -0400, Owen Taylor wrote:
> On Tue, 2005-04-05 at 15:02 +0800, Charles Wang wrote:
> > Hi Carl:
> >
> > Thanks for you quickly reply, got your idea. :)
> >
> > I think you let me to do the following things:
> > d = malloc(...);
> > sr = cairo_image_surface_create_for_data(d, CAIRO_FORMAT_XXX, w, h,
> > stride);
> > cairo_surface_set_user_data(sr, "IMG", d, free);
> >
> > It should be complex than just call
> > 'caior_image_surface_assume_ownershipt_of_data' and might encounter key
> > conflict problem, The prototype of user data destroy callback must also
> > compatible with 'free' in libc, otherwise we have to define a callback
> > for this common simple position.
>
> (cairo_destroy_func_t)free will always work. No cast is necessary.
^^^^
Errr, callback, that is.
Owen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050405/842eb884/attachment.pgp
More information about the cairo
mailing list