[gtk+] iconview: Fix updates with filter models



commit ffef28a7e8d5ffef7de6a3baccb30b0021b6b0ff
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 0ace6ce..86be6f8 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -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);


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