fix error in set_snap(): should not do a redraw (draw() ) here, causing a segfault if x11/tk structures are not ready yet. add draw() in places where this function is called if there is something to draw/

This commit is contained in:
stefan schippers 2024-03-01 00:39:24 +01:00
parent 263b72de03
commit 28aec3fad8
3 changed files with 3 additions and 1 deletions

View File

@ -300,7 +300,6 @@ void set_snap(double newsnap) /* 20161212 set new snap factor and just notify n
}
xctx->cadhalfdotsize = CADHALFDOTSIZE * (cs < 10. ? cs : 10.) / 10.;
tclsetdoublevar("cadsnap", cs);
draw();
}
void set_grid(double newgrid)

View File

@ -2207,6 +2207,7 @@ int rstate; /* (reduced state, without ShiftMask) */
if(key=='g' && rstate==0) /* half snap factor */
{
set_snap(c_snap / 2.0);
draw();
break;
}
if(key=='g' && rstate==ControlMask) /* set snap factor 20161212 */
@ -2220,6 +2221,7 @@ int rstate; /* (reduced state, without ShiftMask) */
if(key=='G' && rstate == 0) /* double snap factor */
{
set_snap(c_snap * 2.0);
draw();
break;
}
if(key=='*' && EQUAL_MODMASK) /* svg print , 20121108 */

View File

@ -4546,6 +4546,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[2], "cadsnap")) { /* set mouse snap (default: 10) */
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
set_snap( atof(argv[3]) );
draw();
}
else if(!strcmp(argv[2], "color_ps")) { /* set color psoscript (1 or 0) */
color_ps=atoi(argv[3]);