[gtk+/gtk-3-22] iconview: Fix updates with filter models



commit 5ab5a5166eda774ddabf8d4fe29eda0be03c4af2
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 19 16:04:18 2018 +0100

    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.

 gtk/gtkiconview.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 4062bfd..4b364d5 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -3466,6 +3466,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 ();
@@ -3502,11 +3504,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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]