[Gdal-dev] segfault in SHPCreateObject

Ari Jolma ari.jolma at tkk.fi
Tue Sep 13 03:51:29 EDT 2005


Frank Warmerdam wrote:

>When creating a feature you intend to write out to a layer with
>CreateFeature(), you should use the featuredefn from that layer
>for the feature.   It should be very rare that you need to create
>your own freestanding OGRFeatureDefn objects. 
>  
>

Sorry for making multiple threads but my thunderbird tends to classify 
gdal-dev as junk and I did not notice this before.

Ok, but that was not the source of the segfault I think. In this case 
the layer is a brand new, just constructed. So the correct (?) way to 
create a new layer  is to:

create layer
CreateFields into the layer
featuredefn = layer.GetLayerDefn
use this featuredefn for all features which are CreateFeature'd into the 
layer

Ari




More information about the Gdal-dev mailing list