[gtk+] In sort model also emit row-deleted after updating the data structures



commit df0fcfb940f05a40fe69dcd86fed60cfd8312391
Author: Kristian Rietveld <kris gtk org>
Date:   Mon May 9 10:29:54 2011 +0200

    In sort model also emit row-deleted after updating the data structures

 gtk/gtktreemodelsort.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c
index 9a59a80..df24a6a 100644
--- a/gtk/gtktreemodelsort.c
+++ b/gtk/gtktreemodelsort.c
@@ -901,12 +901,6 @@ gtk_tree_model_sort_row_deleted (GtkTreeModel *s_model,
   elt = SORT_ELT (iter.user_data2);
   offset = elt->offset;
 
-  /* we _need_ to emit ::row_deleted before we start unreffing the node
-   * itself. This is because of the row refs, which start unreffing nodes
-   * when we emit ::row_deleted
-   */
-  gtk_tree_model_row_deleted (GTK_TREE_MODEL (data), path);
-
   gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
 
   while (elt->ref_count > 0)
@@ -919,7 +913,9 @@ gtk_tree_model_sort_row_deleted (GtkTreeModel *s_model,
        * Careful, root level is not cleaned up in increment stamp.
        */
       gtk_tree_model_sort_increment_stamp (tree_model_sort);
+      gtk_tree_model_row_deleted (GTK_TREE_MODEL (data), path);
       gtk_tree_path_free (path);
+
       if (level == tree_model_sort->priv->root)
 	{
 	  gtk_tree_model_sort_free_level (tree_model_sort, 
@@ -929,8 +925,6 @@ gtk_tree_model_sort_row_deleted (GtkTreeModel *s_model,
       return;
     }
 
-  gtk_tree_model_sort_increment_stamp (tree_model_sort);
-
   /* Remove the row */
   for (i = 0; i < level->array->len; i++)
     if (elt->offset == g_array_index (level->array, SortElt, i).offset)
@@ -948,6 +942,9 @@ gtk_tree_model_sort_row_deleted (GtkTreeModel *s_model,
 	elt->children->parent_elt_index = i;
     }
 
+  gtk_tree_model_sort_increment_stamp (tree_model_sort);
+  gtk_tree_model_row_deleted (GTK_TREE_MODEL (data), path);
+
   gtk_tree_path_free (path);
 }
 



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