[GRASS-dev] v.digit segfault with tcltk 8.3 -- solution?
Hamish
hamish_nospam at yahoo.com
Thu May 10 06:00:55 EDT 2007
Hi,
WRT the "new" v.digit segfaulting on startup (Tcl/Tk 8.3; Debian/Sarge;
i686), I have traced it to vector/v.digit/driver.c in the get_window()
fn:
Tcl_Eval(Toolbox, "list 0 [winfo height .screen.canvas] 0 [winfo width .screen.canvas]");
even this breaks it:
Tcl_Eval(Toolbox, "list [winfo height .screen.canvas]");
or just
Tcl_Eval(Toolbox, "list [expr 1+1]");
or
Tcl_Eval(Toolbox, "concat [expr 1]");
while this works:
Tcl_Eval(Toolbox, "winfo height .screen.canvas");
note that a few lines later it calls this, without error:
Tcl_Eval(Toolbox, "list 0 [.screen.canvas cget -height] 0 [.screen.canvas cget -width]");
no idea why nesting [commands] matters, but without [] it works & the
attached patch gets v.digit working again for tcltk 8.3.
ok for CVS?
Hamish
-------------- next part --------------
Index: vector/v.digit/driver.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/vector/v.digit/driver.c,v
retrieving revision 1.8
diff -u -r1.8 driver.c
--- vector/v.digit/driver.c 24 Feb 2007 21:38:37 -0000 1.8
+++ vector/v.digit/driver.c 10 May 2007 09:16:30 -0000
@@ -55,8 +55,13 @@
static void get_window(int *t, int *b, int *l, int *r)
{
- Tcl_Eval(Toolbox, "list 0 [winfo height .screen.canvas] 0 [winfo width .screen.canvas]");
- sscanf(Toolbox->result, "%d %d %d %d", t, b, l, r);
+ *t = *l = 0;
+
+ Tcl_Eval(Toolbox, "winfo height .screen.canvas");
+ sscanf(Toolbox->result, "%d", b);
+
+ Tcl_Eval(Toolbox, "winfo width .screen.canvas");
+ sscanf(Toolbox->result, "%d", r);
if (*b > 1 || *r > 1)
return;
@@ -96,7 +101,7 @@
if (Tcl_Eval(Toolbox, "create_screen") != TCL_OK)
G_warning("create_screen: %s", Toolbox->result);
-
+
setup();
More information about the grass-dev
mailing list