[Gdal-dev] Exception thrown in GDALOpen() function

Frank Warmerdam warmerdam at pobox.com
Sat Aug 2 21:26:01 EDT 2003


N. Farah wrote:
> Ben,
> 
> My call to GDALOpen() is now working after having the binaries in debug 
> mode as my program is in debug mode. I'm opening a tif file and 
> translating it to erdase imagine for testing purposes (i'm aware that a 
> program already exist for that operation). I'm kind of exploring GDAL now.
> 
> My steps are simple:
> - Drivers registration (here tiff and imagine),
> - GDALOpen()..
> - GDALGetDriverByName()
> - GDALCreateCopy().
> 
> All the steps went fine except the last one. The .img file is created 
> and seems to be ok.
> The exception is risen in the cleaning phase. GDALOpenInfo object is 
> being destructed and an exception is risen when trying to close the .img 
> file.
> 
> After a bit of investigation, i found out that .img is opened (in the 
> source code) using VSIFOpenL function (in the HFAOpen() method), then 
> the file pointer is passed back to the GDALOpenInfo  object.

Noureddine,

HFAOpen() does indeed use VSIFOpenL(), but I don't see how the
HFADataset::Open() method would end up propagating this "large" file
pointer back into the GDALOpenInfo. I am looking at the current CVS
source, but I didn't think this changed since 1.1.9 was released.

In your next email you mention correcting the problem.  Could you let
me know what change you had to make, and verify that you were working
with GDAL 1.1.9?

Best regards,

> Once the destructed of GDALOpenInfo  is called, the file is being closed 
> with VSIFClose. In the imagine case the closing would be done using 
> VSIFCloseL and not VSIFClose. I guess that this is what causing the 
> exception. It appears that GDALOpenInfo assume that the file is always 
> opened using VSIFOpen.
> 
> 
> Noureddine Farah


-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list