[FWTools] GDALOpen craches the second time it is called....
Kolberg Sjur A
Sjur.A.Kolberg at sintef.no
Wed May 14 05:39:33 EDT 2008
Hello, list!
Does anybody recognise the following problem with reading more than one HDF5 file within a program run?
I have three (out of a bunch) similar .h5 files of weather radar data from different times. My C++ program can open any of the three if stopped and restarted between each file. Opening the second file within a program run makes GDALOpen() crash, no matter which of the three files that is.
FWTools 2.1.0 on Windows, MSVC 2005 (8.0) SP 1; the offending code is:
CString ImgName = "HDF5:\""+SrcFname+"\"://image1/data";
GDALDataset *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";}
This code sequence is copied just as is, so the parameter to GDALOpen() is a local variable defined immediately before the call. The code works fine with the first file, but for the second, the execution stops at the GDALOpen() call in the try block. No exception is thrown. The error MessageBox states:
"Unhandled exception at 0xfeeefeee in ProgHBV.exe: 0xC0000005: Access violation reading location 0xfeeefeee."
and the output window in the debugger confirms:
First-chance exception at 0xfeeefeee in ProgHBV.exe: 0xC0000005: Access violation reading location 0xfeeefeee.
Unhandled exception at 0xfeeefeee in ProgHBV.exe: 0xC0000005: Access violation reading location 0xfeeefeee.
After the first successful call to GDALOpen() I can use the debugger to move the execution point back to the CString ImgName line, and repeat the call with no problem.
But if I let the program run, and select the same file once more, it crashes.
It seems that some library or object gets de-initialized or otherwise destroyed between the two calls, but I am unable to guess or see in the code what that should be. This has worked nicely before, but I have been working with the code, and also changed fwtools version.
Does anyone have a clue?
The call stack states (blank lines inserted for clarity):
feeefeee()
gdal_fw.dll!10031b78()
[Frames below may be incorrect and/or missing, no symbols loaded for gdal_fw.dll]
ProgHBV.exe!CProgHBVApp::ImportRadarH5(ATL::CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char> > > SrcFname="J:\Prosjekt\Avd12\12X407_Kvantitative_varvarsler\Under_Arbeid\Radar\rissa\PSC_RA1h-N2-RSA_PS0E60N1_200701190300.h5", ATL::CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char> > > SrcCoordsyst="MIradar_1kmPSgrid", ATL::CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char> > > TrgCoordsyst="utm-32n", int resampmethod=1) Line 889 + 0x1d bytes C++
ProgHBV.exe!CProgHBVDlg::OnAddprogButton() Line 468 + 0xa5 bytes C++
Grateful for any help...
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