treemodelsort: destroy the root only if we are removing the latest row of the level

GtkIconView doesn't ref the rows of the model so we have to make sure that a
level is actually empty before destroying it.

https://bugzilla.gnome.org/show_bug.cgi?id=698846
This commit is contained in:
Guillaume Desmottes
2013-04-25 16:30:12 +02:00
parent 2b6c684569
commit c15a7877e9
2 changed files with 34 additions and 1 deletions

View File

@ -1061,7 +1061,7 @@ gtk_tree_model_sort_row_deleted (GtkTreeModel *s_model,
gtk_tree_model_sort_free_level (tree_model_sort,
elt->children, FALSE);
if (level->ref_count == 0)
if (level->ref_count == 0 && g_sequence_get_length (level->seq) == 1)
{
gtk_tree_model_sort_increment_stamp (tree_model_sort);
gtk_tree_model_row_deleted (GTK_TREE_MODEL (data), path);