[GRASS-dev] gis.m crashes on zoom-out

Glynn Clements glynn at gclements.plus.com
Tue Apr 24 14:55:16 EDT 2007


Hamish wrote:

> > > > Hamish wrote:
> > > > > found a bug in gis.m zoom out tool.
> > > > > 
> > > > > start gis.m, select zoom out, draw a box, and poof! gis.m
> > > > > crashes.
> > > > > 
> > > > > happens always in a lat long location when you zoom out past
> > > > > 90NS 180EW view or a bit harder to trigger in spearfish, but
> > > > > crashes on the 4th or 5th zoom out when the rows*cols gets to be
> > > > > something silly like 500e6*500e6.
> > > > > 
> > > > > presumably g.region exits with an error which isn't handled
> > > > > well.
> > > 
> > > Glynn Clements wrote:
> > > > Yep.
> > > > 
> > > > If you spawn a child process with "open |...", any errors are
> > > > reported by way of the corresponding "close" throwing an
> > > > exception. Tcl's definition of "error" includes anything being
> > > > written to stderr (so any warnings are treated as errors), as well
> > > > as a non-zero exit code.
> > > > 
> > > > Any calls to "close" on a subprocess pipe should be enclosed in a
> > > > catch statement.
> > > >
> Hamish:
> > > gui/tcltk/gis.m$ grep close * | grep -v catch
> > > 
> > > 
> > > finds this one in georect.tcl
> > >   proc GRMap::zoom_gregion { args} {
> > > 
> > > and in histogram.tcl:
> > >   proc GmHist::display { node mod } {
> > > 
> > > and in rastnums.tcl:
> > >   proc GmRnums::display { node mod } {
> > > 
> > > and in runandoutput.tcl:
> > >   proc guarantee_xmon {} {
> > > 
> > > 
> > > ..maybe more?
> > > 
> > > I don't see the open|g.region in mapcanvas.tcl which triggers this
> > > bug?
> > >
> Glynn:
> > Line 585, in Mapcanvas::runprograms:
> > 
> > 		if {[catch {close $input} error]} {
> > 			puts $error
> > 			exit 1
> > 		}
> > 
> > It catches the error, then prints the error message and exits. Not
> > really much point in catching it.
> 
> So what would the soltution look like?

Catch then don't exit, just return from the procedure (possibly after
some form of error recovery).

> Would the above catch+puts+exit
> in the histogram or georect tool only bring down those tools and not all
> of gis.m as they do now?

No, "exit" terminates wish, i.e. gis.m.

> histogram.tcl and rastnums.tcl probably need a catch on the open as well?

Ideally.

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




More information about the grass-dev mailing list