From a510028bb96130264bc711a0dfeaf6959ddde43c Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 28 Jul 2012 16:53:09 +0000 Subject: [PATCH] Fix an embarrassing mistake in config box handling which was causing changes to any SSH bug config option to be lost when the config box switched to a different panel, at least on GTK. git-svn-id: svn://svn.tartarus.org/sgt/putty@9591 cda61777-01e9-0310-a592-d414129be87e --- config.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config.c b/config.c index de21cbbd..e2a7951c 100644 --- a/config.c +++ b/config.c @@ -529,12 +529,19 @@ static void sshbug_handler(union control *ctrl, void *dlg, { Conf *conf = (Conf *)data; if (event == EVENT_REFRESH) { + /* + * We must fetch the previously configured value from the Conf + * before we start modifying the drop-down list, otherwise the + * spurious SELCHANGE we trigger in the process will overwrite + * the value we wanted to keep. + */ + int oldconf = conf_get_int(conf, ctrl->listbox.context.i); dlg_update_start(ctrl, dlg); dlg_listbox_clear(ctrl, dlg); dlg_listbox_addwithid(ctrl, dlg, "Auto", AUTO); dlg_listbox_addwithid(ctrl, dlg, "Off", FORCE_OFF); dlg_listbox_addwithid(ctrl, dlg, "On", FORCE_ON); - switch (conf_get_int(conf, ctrl->listbox.context.i)) { + switch (oldconf) { case AUTO: dlg_listbox_select(ctrl, dlg, 0); break; case FORCE_OFF: dlg_listbox_select(ctrl, dlg, 1); break; case FORCE_ON: dlg_listbox_select(ctrl, dlg, 2); break; -- 2.11.0