[gdal-dev] OGRLayer::SetFeature fails with out of date OGRFeature

Even Rouault even.rouault at mines-paris.org
Tue Apr 27 16:32:43 EDT 2010


It is illegal to change the layer definition with CreateField() if you have 
pre-existing features of that layer. This is documented here : 

There's no way to check if the feature is "valid". So, just don't do it ;-)

Le Tuesday 27 April 2010 21:17:17 Ramiro Gonzalez, vous avez écrit :
> My application uses OGR to edit ESRI Shapefiles.
> If I follow this steps:
> 1_ Create a feature(OGRFeature::CreateFeature) using the feature definition
> from an existing layer(layerA)
> 2_ Add a field (OGRLayer::CreateField) to layerA
> 3_ Try to save the feature (OGRLayer::SetFeature) in layerA
> I receive a SIGSEGV from function OGRFeature::SetField. I believe this
> happens because I modify the layer definition in step 2 leaving the feature
> definition out of date.
> I'd like to know if there is any way to check if the feature is valid
> before calling SetFeature.
> Thanks
> Ramiro

More information about the gdal-dev mailing list