Le mercredi 07 octobre 2015 12:51:05, Luca Delucchi a écrit :
> Hi everybody,
> 
> I'm fixing some problem with a QGIS plugin, and I'm fighting with a
> problem with postgis OGRFeature that it crash QGIS for a
> __GI___libc_free problem. The log of gdb is available here [0].
> 
> The error appear at the end of write_layer_single function (line 204)
> during the return of this file [1]. I tried to fix in several way, but
> I'm not able to understand. The error appear only with
> postgresql/postgis datasource, not with other.
> 
> Thanks a lot for any suggestion

Luca,

I'm not completely sure if this is the reason, but there's at least something 
to correct related to the use of:

self.feat_defn.AddFieldDefn(style_field)

Quoting OGRFeatureDefn::AddFieldDefn() documentation  
http://gdal.org/classOGRFeatureDefn.html#a40e681d8464b42f1a1fac655f16ac3dd :

"To add a new field definition to a layer definition, do not use this function 
directly, but use OGRLayer::CreateField() instead."

Hum actually looking more closely, I think the issue is that you modify the 
layer definition after having accumulated features in the "features" 
dictionary.

Still quoting OGRFeatureDefn::AddFieldDefn() documentation 
"This method should only be called while there are no OGRFeature objects in 
existance based on this OGRFeatureDefn."

So you should probably call outLayer.CreateField() before reading the postgres 
features.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to