]> Pileus Git - ~andy/gtk/commitdiff
gtktreemodelfilter: child levels of the root level must remain cached
authorKristian Rietveld <kris@gtk.org>
Wed, 7 Sep 2011 20:11:37 +0000 (22:11 +0200)
committerKristian Rietveld <kris@gtk.org>
Wed, 7 Sep 2011 20:25:29 +0000 (22:25 +0200)
This is due to the special handling for filter functions that depend
on child level state.  If the parent level of a level is the root level,
the level cannot be removed from the cache.  Any change in this level
can cause its parent in the root level to become visible again.

gtk/gtktreemodelfilter.c

index d3560eda6fb39327ae78a839262bce113ba2e0a3..bf954e12bcadc0cf2db7750eadc9012793dc9c30 100644 (file)
@@ -1302,9 +1302,13 @@ gtk_tree_model_filter_clear_cache_helper (GtkTreeModelFilter *filter,
    * free the level if the parent level also has an external ref
    * count of zero.  In that case, changes concerning our parent are
    * not requested.
+   *
+   * The root level is always visible, so an exception holds for levels
+   * with the root level as parent level: these have to remain cached.
    */
   if (level->ext_ref_count == 0 && level != filter->priv->root &&
-      level->parent_level && level->parent_level->ext_ref_count == 0)
+      level->parent_level && level->parent_level != filter->priv->root &&
+      level->parent_level->ext_ref_count == 0)
     {
       gtk_tree_model_filter_free_level (filter, level, TRUE, FALSE);
       return;