iconview: Fix updates with filter models

Filter models rely on views taking a ref on every node
they care about. GtkIconView was not doing that. Amazingly,
this has never shown up in a bug so far, until I spotted
the fallout in gnome-font-viewer.
This commit is contained in:
Matthias Clasen 2018-01-19 16:04:18 +01:00
parent f942d6f53c
commit ffef28a7e8

View File

@ -3270,6 +3270,8 @@ gtk_icon_view_row_inserted (GtkTreeModel *model,
if (gtk_tree_path_get_depth (path) > 1)
return;
gtk_tree_model_ref_node (model, iter);
index = gtk_tree_path_get_indices(path)[0];
item = gtk_icon_view_item_new ();
@ -3306,11 +3308,15 @@ gtk_icon_view_row_deleted (GtkTreeModel *model,
GtkIconViewItem *item;
GList *list, *next;
gboolean emit = FALSE;
GtkTreeIter iter;
/* ignore changes in branches */
if (gtk_tree_path_get_depth (path) > 1)
return;
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_unref_node (model, &iter);
index = gtk_tree_path_get_indices(path)[0];
list = g_list_nth (icon_view->priv->items, index);