[GRASS-dev] opening and closing rasters: hangup error on close raster.

Volker Wichmann wichmann at laserdata.at
Fri Nov 30 15:30:18 EST 2007


Glynn Clements wrote:

>Duffy, Garret wrote:
>
>  
>
>>I'm having major problems with some C code I'm writing within the GRASS
>>environment.  Basically, my code opens 6 rasters, 3 of which exist
>>already the other 3 are new.  When I look at the code with ddd
>>everything seems fine, i.e. the arrays for the new rasters are created
>>as required but when it comes to closing the rasters, the
>>previously-existing rasters close fine but I get 'hangup' error when I
>>try to close the first newly-created raster, the code crashes and I lose
>>the new rasters.
>>    
>>
>
>"Hangup" normally refers to closing the terminal. It's possible that
>one of the variables which holds a descriptor has the wrong value, and
>closing it closes the terminal.
>
>  
>
>>Following is the mechanisms I use to open and close the files.  I would
>>like some expert advice on whether anything looks strange just so I can
>>debug elsewhere in the code.
>>
>>    
>>
I'm not that familiar with GRASS module programming, but as you wrote 
"... I can debug somewhere else in the code" I assume you perform some 
read / write operations in between.
- a stepwise approach would be useful, so just open and close the 
rasters; if the error still applies I can't help
- just read from the existing rasters
- write to the new rasters: a typical mistake would be to write outside 
of the bounds of the arrays; at least in other GIS this may work some 
time but will cause a crash on exit. Another problem might be an 
unintentional calculation on NoData cells.

maybe this helps,
Volker

>Apart from the issues noted above (which wouldn't cause the problems
>you describe), I don't see anything wrong with your code.
>
>  
>



More information about the grass-dev mailing list