[GRASS-dev] [bug #4725] (grass) nviz crashed while volume visualisation

Glann,

to me it is not entirely clear how to implement your
suggestion...

Markus

-------------------------------------------- Managed by Request Tracker

Markus Neteler via RT wrote:

to me it is not entirely clear how to implement your
suggestion...

The variables are initially set in mkmainPanel in panel_main.tcl.

The top-level of nviz2.2_script calls Nv_makeGUI, which calls
"Nv_openPanel main 0", which calls mkmainPanel. However, Nv_makeGUI
creates the Togl widget early on, and the main panel much later. If
anything causes a redraw inbetween, you will get the error which you
report.

Either the creation of the Togl canvas needs to be delayed until
/everything/ required by the redraw handler has been done, or the
redraw handler needs to be made more robust so that it at least
doesn't crash if it gets called too early.

At a minimum, you can fix the specific crash by protecting all of the
atoi() calls in Ndraw_all_together_cmd() with checks to ensure that
their arguments (obtained from Tcl_GetVar) are non-NULL, e.g.

- if (atoi(buf_surf) == 1)
+ if (buf_surf && atoi(buf_surf) == 1)

Or move all of the Tcl_GetVar() calls to the top of the function and
add a single check, i.e.:

  if (!buf_surf || !buf_vect || ... )
    return (TCL_OK);

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