How is this handled in gtk perl?



Hi,

I'm working in the GDAL developers group and writing the Perl port of swig bindings for GDAL. There is an issue of references, which is perhaps best shown in an example:

$layer = gdal::Open('datafile').GetLayer(1);

$layer is not usable after this since the data source was only a temporary and when it was destroyed, the actual layer was also and thus $layer is left without anything real and using it causes a segfault.

There is a reference count system in the underlying C++ system for data source class and we could utilize it to delay deletion of the actual data source until the $layer object is destroyed. The problem is, the $layer object would need a pointer to the data source object and I don't know how to manage that. Also the chain could be longer that just data source -> layer.

Is this issue an issue in gtk-perl bindings and/or how it was fixed or dealt with? Do you have any recommendations/ideas? Of course the swig is an added complication and the need to support more languages that Perl.

Ari

--
Prof. Ari Jolma
Kartografia ja Geoinformatiikka / Cartography and Geoinformatics
Teknillinen Korkeakoulu / Helsinki University of Technology
POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]