[FWTools] GDALOpen craches the second time it is called....

Kolberg Sjur A Sjur.A.Kolberg at sintef.no
Wed May 14 16:19:02 EDT 2008


 

-----Original Message-----
From: fwtools-bounces at lists.maptools.org [mailto:fwtools-bounces at lists.maptools.org] On Behalf Of Kolberg Sjur A
Sent: Wednesday, May 14, 2008 11:40 AM
To: FWTools at lists.maptools.org
Subject: [FWTools] GDALOpen craches the second time it is called....

 
 
Hello again, fwtools,

This is a follow up on today's question on GDALOpen():
(FWTools 2.1.0 on Windows, MSVC 2005 (8.0) SP 1, trying to read HDF5 files.)

I managed to isolate the call that make the next GDALOpen() crash.

Consider this code and ignore the details of the CreateTransformedGrid() call, neither its parameters nor its result is relevant here. The first GDALOpen() call works OK, the second is identical, but crashes. Does anyone have a clue to how the CreateTransformedGrid() call can cause this ?

CString ImgName = "HDF5:\""+SrcFname+"\"://image1/data";
GDALDataset *poDataset = NULL;

	<irrelevant code deleted>

poDataset = NULL;
try
{
	poDataset = (GDALDataset *) GDALOpen(ImgName, GA_ReadOnly);  // Open the source file
}
catch(CException *e){e->ReportError(); e->Delete(); return "Import HDF5 file failed";}
catch(...){return "Unknown exception caught during HDF5 import";}
if (poDataset == NULL) return "Import HDF5 file failed";

GDALDataset *pDstDS = CreateTransformedGrid(pSrcDS,targetWKT,
					targetgrid.Rows(),targetgrid.Cols(),targetgrid.GetWest(),
					targetgrid.GetNorth(), targetgrid.GetResolution(), resampmethod);

poDataset = NULL;
try
{
	poDataset = (GDALDataset *) GDALOpen(ImgName, GA_ReadOnly);  // Open the source file
}
catch(CException *e){e->ReportError(); e->Delete(); return "Import HDF5 file failed";}
catch(...){return "Unknown exception caught during HDF5 import";}
if (poDataset == NULL) return "Import HDF5 file failed";

The error message states
"Unhandled exception at 0xfeeefeee in ProgHBV.exe: 0xC0000005: Access violation reading location 0xfeeefeee."
The memory address has varied through my more or less desperate attempts. No exception is caught by the (...) catch handlers.

Since I use prebuilt fwtools binaries, I cannot track into GDALOpen().
I can put as many GDALOpen() calls with surroundings as I want before the CreateTransformedGrid() call, they all work.



Again I am grateful for any help...

Sjur  :-)


Sjur Kolberg
SINTEF Energiforskning A/S
Sem Sælands vei 11
7465 Trondheim
tlf. 73 59 72 78
fax  73 59 72 50 




More information about the FWTools mailing list