[Gdal-dev] On Feature.setGeometryDirectly SWIG bindings

Ari Jolma ari.jolma at tkk.fi
Sun Mar 18 12:50:56 EDT 2007


Andrea Aime kirjoitti:
>
> One that has been tricky to identify is Feature.setGeometryDirectly.
> This issue is there because every SWIG wrapper
> does deallocate its C++ counterpart when garbage collected,
> and thus the OGR Feature that got is geometry thru setGeometryDirectly
> is left with a dangling reference.

AFAI understand the SWIGTYPE *DISOWN that is used with that method 
should take care of the issue. The garbage collection system of the 
bound language should not deallocate the C++ object if it does not own it.

On the other hand, one method which seems to be missing DISOWN, is the 
constructor of Feature. Since it assumes the ownership of the 
FeatureDefinition (which however is not usually owned by the bound 
language to begin with) it should be disowned.

Ari


-- 
Prof. Ari Jolma
Geoinformaatio- ja paikannustekniikka
Geoinformation and positioning technology
Teknillinen Korkeakoulu / Helsinki University of Technology
POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma




More information about the Gdal-dev mailing list