[cairo] cairo_image_surface_create_for_png() fclose()

Steve Chaplin stevech1097 at yahoo.com.au
Sat Apr 9 00:24:13 PDT 2005


Why does cairo_image_surface_create_for_png() take a FILE *
and then call fclose()?

I think it should either do
1) both fopen and fclose (and take a filename argument)
or
2) neither fopen nor fclose

I created a Python wrapper which takes a fileObject and 
passes the underlying FILE * to cairo_image_surface_create_for_png().
The call to fclose causes a segmentation fault since Python
is expecting to do the fclose itself. Removing the fclose fixes the 
problem.

Also, I agree with the earlier message which said
cairo_image_surface_create_for_png()
should return the surface only, and use a 'getter' function to read
the width and height.

Steve





More information about the cairo mailing list