From 92caf21c2c6181a6deada35044159ab814d623ea Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 14 Apr 2008 17:57:45 +0000 Subject: [PATCH] Prevent assertion failure in the case where the user manipulates the 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 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/unix/gtkfont.c b/unix/gtkfont.c index d73e920a..02eadb49 100644 --- a/unix/gtkfont.c +++ b/unix/gtkfont.c @@ -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,