[gdal-dev] crashes at CreateDataSource

Even Rouault even.rouault at spatialys.com
Tue Jan 5 02:10:54 PST 2016


Le mardi 05 janvier 2016 10:54:57, Gane R a écrit :
> gdal version gdal-1.11.3 - Filegeodbversion 1.4
> {
> OGRSFDriverRegistrar    *poR;                    //Pointer to hold the
> driver registration
> OGRSFDriver                *poDriver;
> OGRDataSource            *poODS;
> OGRRegisterAll();
> poR = OGRSFDriverRegistrar::GetRegistrar();
> poDriver = poR->GetDriverByName("FileGDB");
> poODS = poDriver->CreateDataSource("sample1.gdb",NULL);
> /*
> Here adding layeres and fields and geom
> Finnally closing the dataset OGRDataSource::DestroyDataSource( poODS );
> *OGRCleanup not called.*
> */
> }
> *First time the code works fine, and the second time different .gdb name
> the code crashes at createDatasource.*
> 
> *This is a snippet of code, I get crash at CreateDataSource second time for
> another filename, this code I am trying to put inside a DLL*
> 
>  *features created are destroyed.OGRFeature::DestroyFeature( poFeature );*
> Do I use the API correctly? any suggestions, What the cause of this crash

Difficult to say without a full reproducer.

I've just tested the below Python script with the 1.11 branch and FileGDB 1.4 
on Linux and it works fine:

from osgeo import ogr
from osgeo import osr

for i in range(10):
    ds = ogr.GetDriverByName('FileGDB').CreateDataSource('test%d.gdb'% i)
    srs = osr.SpatialReference()
    srs.ImportFromEPSG(4326)
    lyr = ds.CreateLayer('test', geom_type = ogr.wkbPoint, srs = srs)
    lyr.CreateField(ogr.FieldDefn('id', ogr.OFTInteger))
    f = ogr.Feature(lyr.GetLayerDefn())
    f['id'] = 1
    f.SetGeometry(ogr.CreateGeometryFromWkt('POINT (2 49)'))
    lyr.CreateFeature(f)



-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list