I imagined it was something with features scope. Thanks Howard, for
now I will use your snippet... as I can't find a different way to
prevent the problem.

2009/5/6 Howard Butler <hobu....@gmail.com>:
>
> On May 6, 2009, at 10:02 AM, G. Allegri wrote:
>>
>> geometries = [features[i].GetGeometryRef() for i in range(len(features))]
>
> features[i] is a temporary and goes poof once it goes out of scope.
>  GetGeometryRef depends on features[i] staying alive for *its* entire
> lifetime as well.  In short, you can't depend on the reference counting of
> the objects in this instance.
>
> I will note this is awful, but it should not segfault:
>
> geometries =
> [ogr.CreateGeometryFromWkb(features[i].GetGeometryRef().ExportToWkb()) for i
> in range(len(features))]
>
>
>
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to