On 12/14/2012 01:19 PM, Gianluca Natale wrote:

Unfortunately it crashed with any version of cairo library (gotten from http://ftp.acc.umu.se/pub/gnome/binaries/win32), and any .svg file I tested.

I ended up looking deeper at documentation of cairo library.

Specifically, since the crash happened (as shown here below in yellow) when it tries to free the memory allocated for a cairo_surface_t,

I looked at cairo.h, and found this comment:

* Memory management of #cairo_surface_t is done with

* cairo_surface_reference() and cairo_surface_destroy().

So, I tried to replace the call (at yellow line here below):

free(cairo_surface);

with a:

cairo_surface_destroy(cairo_surface);

I rebuilt osgdb_svg.dll, and now it seems to work. I can load any .svg file and use as a texture with no crash.

But I still wonder if that replacement really deallocates the memory allocated for the cairo surface.


Hi, Gianluca,

This change has already been made in SVN (r12945, by Jason Beverage). The log indicates the change was made because it was causing a crash in Windows.

From my experience in using cairo for several years, this is the correct way to destroy a cairo surface. Using free was a bug from the beginning, as cairo surfaces (like all cairo objects) are internally reference counted.

--"J"


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to