[gdal-dev] OGRDataSource::CreateLayer error on application exit
Andy Canfield
andy.canfield at gmail.com
Fri Mar 29 13:38:13 PDT 2013
If I create a shapefile layer like so:
const char *pszShpDriverName = "ESRI Shapefile";
OGRSFDriver *poShpDriver;
poShpDriver =
OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(pszShpDriverName);
poShpDS = poShpDriver->CreateDataSource(pszDstFilename, NULL);
poShpLayer = poShpDS->CreateLayer( "poly_out", NULL, wkbPolygon, NULL );
and close it like so:
OGRDataSource::DestroyDataSource(poShpDS);
I have no problems, but if I specify a projection for it from an open
GeoTiff I have
as the data set "poDataset" like so:
OGRSpatialReference *poSrcSRS = new
OGRSpatialReference(poDataset->GetProjectionRef());
const char *pszShpDriverName = "ESRI Shapefile";
OGRSFDriver *poShpDriver;
poShpDriver =
OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(pszShpDriverName);
poShpDS = poShpDriver->CreateDataSource(pszDstFilename, NULL);
poShpLayer = poShpDS->CreateLayer( "poly_out", poSrcSRS, wkbPolygon, NULL );
I get this error when I go to shut my application down after using the
above code be it in a dll or in a console app.
The error I get is:
First-chance exception at 0x7c90e4ff in TestApp.exe: 0xC0000008: An invalid
handle was specified
that jumps my debugger to crt0dat.c to this method:
void __cdecl __crtExitProcess (
int status
)
{
__crtCorExitProcess(status);
/*
* Either mscoree.dll isn't loaded,
* or CorExitProcess isn't exported from mscoree.dll,
* or CorExitProcess returned (should never happen).
* Just call ExitProcess.
*/
ExitProcess(status);
}
This only happens when I create the file using a projection and it doesn't
seem to matter if I build the projection myself or get it from the GeoTiff.
It seems to be the creation of the .prj file that is the problem.
I could always just create my own prj file in the same directory and spit
out the WKT to it but I would rather not if I don't have to.
Anyone know a fix for this?
Thank You,
Andy Canfield
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130329/3e268de9/attachment-0001.html>
More information about the gdal-dev
mailing list