[patch] GtkTreeModelSort needs to pass ref_node and unref_node through to child



I started using GtkTreeModelSort for the Nautilus tree sidebar panel. I ran
into a problem, and this patch fixes it. Does it look OK to commit?

===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreemodelsort.c,v
retrieving revision 1.51
diff -p -u -r1.51 gtktreemodelsort.c
--- gtk/gtktreemodelsort.c    2002/02/06 17:24:28    1.51
+++ gtk/gtktreemodelsort.c    2002/02/08 03:31:31
@@ -1091,6 +1091,7 @@ gtk_tree_model_sort_ref_node (GtkTreeMod
                   GtkTreeIter  *iter)
 {
   GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) tree_model;
+  GtkTreeIter child_iter;
   SortLevel *level;
   SortElt *elt;
 
@@ -1098,6 +1099,10 @@ gtk_tree_model_sort_ref_node (GtkTreeMod
   g_return_if_fail (GTK_TREE_MODEL_SORT (tree_model)->child_model != NULL);
   g_return_if_fail (GTK_TREE_MODEL_SORT (tree_model)->stamp ==
iter->stamp);
 
+  GET_CHILD_ITER (tree_model, &child_iter, iter);
+
+  gtk_tree_model_ref_node (GTK_TREE_MODEL_SORT (tree_model)->child_model,
&child_iter);
+
   level = iter->user_data;
   elt = iter->user_data2;
 
@@ -1130,12 +1135,17 @@ gtk_tree_model_sort_unref_node (GtkTreeM
                 GtkTreeIter  *iter)
 {
   GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) tree_model;
+  GtkTreeIter child_iter;
   SortLevel *level;
   SortElt *elt;
 
   g_return_if_fail (GTK_IS_TREE_MODEL_SORT (tree_model));
   g_return_if_fail (GTK_TREE_MODEL_SORT (tree_model)->child_model != NULL);
   g_return_if_fail (GTK_TREE_MODEL_SORT (tree_model)->stamp ==
iter->stamp);
+
+  GET_CHILD_ITER (tree_model, &child_iter, iter);
+
+  gtk_tree_model_unref_node (GTK_TREE_MODEL_SORT (tree_model)->child_model,
&child_iter);
 
   level = iter->user_data;
   elt = iter->user_data2;
===================================================================

    -- Darin




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