common: Fix crash when filtering language list
And it's still being populated. If the list gets filtered while it's being populated, we would end up with a row with NULL data, causing us to crash. Make sure to hold the GDK threads lock when reading from the list, to avoid racing with the insert code. http://bugzilla.gnome.org/show_bug.cgi?id=672293
This commit is contained in:
parent
49ec6af014
commit
ee3f0720f2
1 changed files with 6 additions and 0 deletions
|
@ -46,10 +46,13 @@ cc_language_chooser_get_language (GtkWidget *chooser)
|
|||
|
||||
tv = (GtkTreeView *) g_object_get_data (G_OBJECT (chooser), "list");
|
||||
selection = gtk_tree_view_get_selection (tv);
|
||||
|
||||
gdk_threads_enter ();
|
||||
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||
gtk_tree_model_get (model, &iter, LOCALE_COL, &lang, -1);
|
||||
else
|
||||
lang = NULL;
|
||||
gdk_threads_leave ();
|
||||
|
||||
return lang;
|
||||
}
|
||||
|
@ -245,7 +248,10 @@ filter_languages (GtkTreeModel *model,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_tree_model_get (model, iter, DISPLAY_LOCALE_COL, &locale, -1);
|
||||
gdk_threads_leave ();
|
||||
|
||||
l = g_utf8_casefold (locale, -1);
|
||||
|
||||
visible = strstr (l, filter_string) != NULL;
|
||||
|
|
Loading…
Add table
Reference in a new issue