]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix an embarrassing mistake in config box handling which was causing
authorSimon Tatham <anakin@pobox.com>
Sat, 28 Jul 2012 16:53:09 +0000 (16:53 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 28 Jul 2012 16:53:09 +0000 (16:53 +0000)
changes to any SSH bug config option to be lost when the config box
switched to a different panel, at least on GTK.

[originally from svn r9591]

config.c

index de21cbbd481136d3f7d227bc708fef959f0b7c09..e2a7951ce62e8a1a5c99f413ad017f5ad20cc7df 100644 (file)
--- 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;