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

Glynn Clements glynn at gclements.plus.com
Thu Aug 3 18:09:28 EDT 2006


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 at gclements.plus.com>




More information about the grass-dev mailing list