When the filter removes a node, it needs to remove its children too

In gtk_tree_model_filter_remove_node(), we check if the given elt has
children.  If so, this level will be freed.  This action is recursive.
This commit is contained in:
Kristian Rietveld 2009-09-05 16:12:48 +02:00
parent bf573a1e1e
commit 0c4f29e857

View File

@ -1008,9 +1008,13 @@ gtk_tree_model_filter_remove_node (GtkTreeModelFilter *filter,
GtkTreePath *path;
FilterElt *tmp;
/* we emit row-deleted, and remove the node from the cache.
/* We emit row-deleted, and remove the node from the cache.
* If it has any children, these will be removed here as well.
*/
if (elt->children)
gtk_tree_model_filter_free_level (filter, elt->children);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (filter), iter);
elt->visible = FALSE;
gtk_tree_model_filter_increment_stamp (filter);
@ -1052,10 +1056,16 @@ gtk_tree_model_filter_remove_node (GtkTreeModelFilter *filter,
{
GtkTreePath *path;
/* we emit row-deleted, but keep the node in the cache and
* referenced.
/* We emit row-deleted, but keep the node in the cache and
* referenced. Its children will be removed.
*/
if (elt->children)
{
gtk_tree_model_filter_free_level (filter, elt->children);
elt->children = NULL;
}
path = gtk_tree_model_get_path (GTK_TREE_MODEL (filter), iter);
elt->visible = FALSE;
gtk_tree_model_filter_increment_stamp (filter);
@ -1066,7 +1076,7 @@ gtk_tree_model_filter_remove_node (GtkTreeModelFilter *filter,
{
GtkTreePath *path;
/* blow level away */
/* Blow level away, including any child levels */
path = gtk_tree_model_get_path (GTK_TREE_MODEL (filter), iter);
elt->visible = FALSE;