mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-21 22:28:37 -05:00
Fixes for re-entrant calls in the serial configuration list boxes.
(I'm starting to think I made an egregious design error somewhere in this mechanism.) [originally from svn r8616]
This commit is contained in:
parent
4bddcc2b5d
commit
1e81efc2db
32
sercfg.c
32
sercfg.c
@ -34,6 +34,7 @@ static void serial_parity_handler(union control *ctrl, void *dlg,
|
|||||||
Config *cfg = (Config *)data;
|
Config *cfg = (Config *)data;
|
||||||
|
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
|
int oldparity = cfg->serparity;/* preserve past reentrant calls */
|
||||||
dlg_update_start(ctrl, dlg);
|
dlg_update_start(ctrl, dlg);
|
||||||
dlg_listbox_clear(ctrl, dlg);
|
dlg_listbox_clear(ctrl, dlg);
|
||||||
for (i = 0; i < lenof(parities); i++) {
|
for (i = 0; i < lenof(parities); i++) {
|
||||||
@ -42,12 +43,20 @@ static void serial_parity_handler(union control *ctrl, void *dlg,
|
|||||||
parities[i].val);
|
parities[i].val);
|
||||||
}
|
}
|
||||||
for (i = j = 0; i < lenof(parities); i++) {
|
for (i = j = 0; i < lenof(parities); i++) {
|
||||||
if (cfg->serparity == parities[i].val)
|
if (mask & (1 << i)) {
|
||||||
dlg_listbox_select(ctrl, dlg, j);
|
if (oldparity == parities[i].val) {
|
||||||
if (mask & (1 << i))
|
dlg_listbox_select(ctrl, dlg, j);
|
||||||
|
break;
|
||||||
|
}
|
||||||
j++;
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == lenof(parities)) { /* an unsupported setting was chosen */
|
||||||
|
dlg_listbox_select(ctrl, dlg, 0);
|
||||||
|
oldparity = SER_PAR_NONE;
|
||||||
}
|
}
|
||||||
dlg_update_done(ctrl, dlg);
|
dlg_update_done(ctrl, dlg);
|
||||||
|
cfg->serparity = oldparity; /* restore */
|
||||||
} else if (event == EVENT_SELCHANGE) {
|
} else if (event == EVENT_SELCHANGE) {
|
||||||
int i = dlg_listbox_index(ctrl, dlg);
|
int i = dlg_listbox_index(ctrl, dlg);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
@ -75,6 +84,7 @@ static void serial_flow_handler(union control *ctrl, void *dlg,
|
|||||||
Config *cfg = (Config *)data;
|
Config *cfg = (Config *)data;
|
||||||
|
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
|
int oldflow = cfg->serflow; /* preserve past reentrant calls */
|
||||||
dlg_update_start(ctrl, dlg);
|
dlg_update_start(ctrl, dlg);
|
||||||
dlg_listbox_clear(ctrl, dlg);
|
dlg_listbox_clear(ctrl, dlg);
|
||||||
for (i = 0; i < lenof(flows); i++) {
|
for (i = 0; i < lenof(flows); i++) {
|
||||||
@ -82,16 +92,24 @@ static void serial_flow_handler(union control *ctrl, void *dlg,
|
|||||||
dlg_listbox_addwithid(ctrl, dlg, flows[i].name, flows[i].val);
|
dlg_listbox_addwithid(ctrl, dlg, flows[i].name, flows[i].val);
|
||||||
}
|
}
|
||||||
for (i = j = 0; i < lenof(flows); i++) {
|
for (i = j = 0; i < lenof(flows); i++) {
|
||||||
if (cfg->serflow == flows[i].val)
|
if (mask & (1 << i)) {
|
||||||
dlg_listbox_select(ctrl, dlg, j);
|
if (oldflow == flows[i].val) {
|
||||||
if (mask & (1 << i))
|
dlg_listbox_select(ctrl, dlg, j);
|
||||||
|
break;
|
||||||
|
}
|
||||||
j++;
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == lenof(flows)) { /* an unsupported setting was chosen */
|
||||||
|
dlg_listbox_select(ctrl, dlg, 0);
|
||||||
|
oldflow = SER_FLOW_NONE;
|
||||||
}
|
}
|
||||||
dlg_update_done(ctrl, dlg);
|
dlg_update_done(ctrl, dlg);
|
||||||
|
cfg->serflow = oldflow; /* restore */
|
||||||
} else if (event == EVENT_SELCHANGE) {
|
} else if (event == EVENT_SELCHANGE) {
|
||||||
int i = dlg_listbox_index(ctrl, dlg);
|
int i = dlg_listbox_index(ctrl, dlg);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
i = SER_PAR_NONE;
|
i = SER_FLOW_NONE;
|
||||||
else
|
else
|
||||||
i = dlg_listbox_getid(ctrl, dlg, i);
|
i = dlg_listbox_getid(ctrl, dlg, i);
|
||||||
cfg->serflow = i;
|
cfg->serflow = i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user