mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-21 22:28:37 -05:00
Fix crash in GTK3 when unifontsel filter settings change.
The call to gtk_list_store_clear() in unifontsel_setup_familylist() was causing a call to family_changed() via the GTK signal system, which didn't happen in GTK2. family_changed() in turn was calling unifontsel_select_font(), which got confused when the tree model didn't match reality, and tried to access a bogus tree iterator. This is easily fixed by using the existing fs->inhibit_response flag, which prevents us responding to GTK events when we know they were generated by our own fiddling about with the data; it's just that we never needed to set it in unifontsel_setup_familylist() before. Also, added a check of the return value from the key get_iter call in unifontsel_select_font(), so that it'll at least fail an assertion rather than actually trying to access bogus memory. But that operation _should_ still always succeed, and if it doesn't, it's probably a sign that we need another use of fs->inhibit_response.
This commit is contained in:
parent
03e21b7cad
commit
81682fbf70
@ -2109,6 +2109,8 @@ static void unifontsel_setup_familylist(unifontsel_internal *fs)
|
|||||||
int currflags = -1;
|
int currflags = -1;
|
||||||
fontinfo *info;
|
fontinfo *info;
|
||||||
|
|
||||||
|
fs->inhibit_response = TRUE;
|
||||||
|
|
||||||
gtk_list_store_clear(fs->family_model);
|
gtk_list_store_clear(fs->family_model);
|
||||||
listindex = 0;
|
listindex = 0;
|
||||||
|
|
||||||
@ -2159,6 +2161,8 @@ static void unifontsel_setup_familylist(unifontsel_internal *fs)
|
|||||||
*/
|
*/
|
||||||
if (fs->selected && fs->selected->familyindex < 0)
|
if (fs->selected && fs->selected->familyindex < 0)
|
||||||
unifontsel_deselect(fs);
|
unifontsel_deselect(fs);
|
||||||
|
|
||||||
|
fs->inhibit_response = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unifontsel_setup_stylelist(unifontsel_internal *fs,
|
static void unifontsel_setup_stylelist(unifontsel_internal *fs,
|
||||||
@ -2429,6 +2433,7 @@ static void unifontsel_select_font(unifontsel_internal *fs,
|
|||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
int minval, maxval;
|
int minval, maxval;
|
||||||
|
gboolean success;
|
||||||
GtkTreePath *treepath;
|
GtkTreePath *treepath;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
@ -2469,7 +2474,9 @@ static void unifontsel_select_font(unifontsel_internal *fs,
|
|||||||
treepath);
|
treepath);
|
||||||
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->family_list),
|
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->family_list),
|
||||||
treepath, NULL, FALSE, 0.0, 0.0);
|
treepath, NULL, FALSE, 0.0, 0.0);
|
||||||
gtk_tree_model_get_iter(GTK_TREE_MODEL(fs->family_model), &iter, treepath);
|
success = gtk_tree_model_get_iter(GTK_TREE_MODEL(fs->family_model),
|
||||||
|
&iter, treepath);
|
||||||
|
assert(success);
|
||||||
gtk_tree_path_free(treepath);
|
gtk_tree_path_free(treepath);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user