[GRASS-dev] [GRASS-SVN] r60054

Glynn Clements glynn at gclements.plus.com
Mon May 5 06:27:46 PDT 2014


Huidae Cho wrote:

> G_add_error_handler is a good way to do a cleanup,

I had actually forgetten about the existence of this.

> But again, when they call fatal error internally, they don't have pointers
> to maps. It would be great if we could keep track of opened raster/vector
> maps and properly close existing maps and delete unfinished new maps inside
> G_fatal_error. And use G_add_error_handler to do a non-map related cleanup.

Right.

Anything related to raster maps is available through the R__ structure
in lib/raster (R.h, init.c). R__.fileinfo is an array of "fileinfo"
structures, with R__.fileinfo_count elements. The open_mode field of
each structure will be -1 for unused slots, or one of the OPEN_*
constants (1, 2, or 3) for an open map.

We might want an OPEN_INCOMPLETE value for maps which are in the
process of being opened; this would only be relevant for handling
clean-up for fatal errors from within Rast_open_*.

I'm not that familiar with the vector library, but it looks like
everything relating to a map is stored in a Map_info structure which
is passed in by the caller. There's no global table of vector maps,
right?

If so, I suggest changing that, however invasive it may be. I'd
certainly suggest holding off on any 7.0 release until that's
resolved.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list