]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Prevent assertion failure in the case where the user manipulates the
authorSimon Tatham <anakin@pobox.com>
Mon, 14 Apr 2008 17:57:45 +0000 (17:57 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 14 Apr 2008 17:57:45 +0000 (17:57 +0000)
filter checkboxes to filter the currently selected font out of the
family list and then does something in one of the other list boxes
or the size edit box.

[originally from svn r7990]

unix/gtkfont.c

index d73e920ae104734ca85e5ed476df2580c24c08b6..02eadb4915e478f87a086cd1498cad593ba0397b 100644 (file)
@@ -1392,6 +1392,15 @@ static int fontinfo_selorder_compare(void *av, void *bv)
     return 0;
 }
 
+static void unifontsel_deselect(unifontsel_internal *fs)
+{
+    fs->selected = NULL;
+    gtk_list_store_clear(fs->style_model);
+    gtk_list_store_clear(fs->size_model);
+    gtk_widget_set_sensitive(fs->u.ok_button, FALSE);
+    gtk_widget_set_sensitive(fs->size_entry, FALSE);
+}
+
 static void unifontsel_setup_familylist(unifontsel_internal *fs)
 {
     GtkTreeIter iter;
@@ -1443,6 +1452,13 @@ static void unifontsel_setup_familylist(unifontsel_internal *fs)
        info->familyindex = listindex;
        maxpos = i;
     }
+
+    /*
+     * If we've just filtered out the previously selected font,
+     * deselect it thoroughly.
+     */
+    if (fs->selected && fs->selected->familyindex < 0)
+       unifontsel_deselect(fs);
 }
 
 static void unifontsel_setup_stylelist(unifontsel_internal *fs,