зеркало из https://github.com/github/putty.git
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:
Родитель
03e21b7cad
Коммит
81682fbf70
|
@ -2109,6 +2109,8 @@ static void unifontsel_setup_familylist(unifontsel_internal *fs)
|
|||
int currflags = -1;
|
||||
fontinfo *info;
|
||||
|
||||
fs->inhibit_response = TRUE;
|
||||
|
||||
gtk_list_store_clear(fs->family_model);
|
||||
listindex = 0;
|
||||
|
||||
|
@ -2159,6 +2161,8 @@ static void unifontsel_setup_familylist(unifontsel_internal *fs)
|
|||
*/
|
||||
if (fs->selected && fs->selected->familyindex < 0)
|
||||
unifontsel_deselect(fs);
|
||||
|
||||
fs->inhibit_response = FALSE;
|
||||
}
|
||||
|
||||
static void unifontsel_setup_stylelist(unifontsel_internal *fs,
|
||||
|
@ -2429,6 +2433,7 @@ static void unifontsel_select_font(unifontsel_internal *fs,
|
|||
{
|
||||
int index;
|
||||
int minval, maxval;
|
||||
gboolean success;
|
||||
GtkTreePath *treepath;
|
||||
GtkTreeIter iter;
|
||||
|
||||
|
@ -2469,7 +2474,9 @@ static void unifontsel_select_font(unifontsel_internal *fs,
|
|||
treepath);
|
||||
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->family_list),
|
||||
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);
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче