disable completely callback() event processing if semaphore >=3; this value is set in "proc tclpropeval2" when displaying the script execution warning to avoid nested translate() calls.
This commit is contained in:
parent
36d710d2eb
commit
e534345b2a
|
|
@ -4713,6 +4713,11 @@ int callback(const char *win_path, int event, int mx, int my, KeySym key, int bu
|
||||||
(persistent_command && (xctx->last_command & STARTWIRE));
|
(persistent_command && (xctx->last_command & STARTWIRE));
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
|
|
||||||
|
if(xctx->semaphore >= 3) {
|
||||||
|
dbg(0, "reentrant callback() call disabled, semaphore = %d\n", xctx->semaphore);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/* this fix uses an alternative method for getting mouse coordinates on KeyPress/KeyRelease
|
/* this fix uses an alternative method for getting mouse coordinates on KeyPress/KeyRelease
|
||||||
* events. Some remote connection softwares do not generate the correct coordinates
|
* events. Some remote connection softwares do not generate the correct coordinates
|
||||||
* on such events */
|
* on such events */
|
||||||
|
|
@ -4809,10 +4814,6 @@ int callback(const char *win_path, int event, int mx, int my, KeySym key, int bu
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
if(xctx->semaphore >= 2 && !redraw_only) {
|
|
||||||
xctx->semaphore--;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
dbg(1,"callback(): ConfigureNotify event: %s %dx%d\n", win_path, button, aux);
|
dbg(1,"callback(): ConfigureNotify event: %s %dx%d\n", win_path, button, aux);
|
||||||
resetwin(1, 1, 0, 0, 0);
|
resetwin(1, 1, 0, 0, 0);
|
||||||
draw();
|
draw();
|
||||||
|
|
|
||||||
|
|
@ -4507,7 +4507,6 @@ const char *translate(int inst, const char* s)
|
||||||
if(!s || !xctx || !xctx->inst) {
|
if(!s || !xctx || !xctx->inst) {
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __unix__
|
#ifdef __unix__
|
||||||
if(!get_sp_cur) {
|
if(!get_sp_cur) {
|
||||||
get_sp_cur = my_malloc(_ALLOC_ID_, sizeof(regex_t));
|
get_sp_cur = my_malloc(_ALLOC_ID_, sizeof(regex_t));
|
||||||
|
|
|
||||||
|
|
@ -6960,7 +6960,10 @@ proc tclpropeval2 {s} {
|
||||||
return $res
|
return $res
|
||||||
} elseif { $xschem_execute_scripts eq {ask}} {
|
} elseif { $xschem_execute_scripts eq {ask}} {
|
||||||
if {[info exists has_x]} {
|
if {[info exists has_x]} {
|
||||||
xschem set semaphore [expr {[xschem get semaphore] +1}]
|
# completely disable event processing in callback()
|
||||||
|
# the alert box causes an Expose event, wicht triggers draw() and translate()
|
||||||
|
# but this procedure may be called from within a translate() call...
|
||||||
|
xschem set semaphore [expr {[xschem get semaphore] + 3}]
|
||||||
set msg " Allow xschem to execute scripts embedded in schematics?\n\n"
|
set msg " Allow xschem to execute scripts embedded in schematics?\n\n"
|
||||||
append msg " WARNING:\n"
|
append msg " WARNING:\n"
|
||||||
append msg " Allowing script execution is a potential security vulnerability,\n"
|
append msg " Allowing script execution is a potential security vulnerability,\n"
|
||||||
|
|
@ -6972,7 +6975,7 @@ proc tclpropeval2 {s} {
|
||||||
append msg " Current (default) setting is 'ask'."
|
append msg " Current (default) setting is 'ask'."
|
||||||
|
|
||||||
set answer [alert_ $msg {} 0 1]
|
set answer [alert_ $msg {} 0 1]
|
||||||
xschem set semaphore [expr {[xschem get semaphore] -1}]
|
xschem set semaphore [expr {[xschem get semaphore] - 3}]
|
||||||
# set answer [tk_messageBox -parent [xschem get topwindow] -message $msg -type yesno]
|
# set answer [tk_messageBox -parent [xschem get topwindow] -message $msg -type yesno]
|
||||||
if {$answer eq {1}} {
|
if {$answer eq {1}} {
|
||||||
set xschem_execute_scripts yes
|
set xschem_execute_scripts yes
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue