]> Pileus Git - ~andy/gtk/commitdiff
Remove broken logic in backwards walks in validate_visible_area()
authorKristian Rietveld <kris@gtk.org>
Sun, 23 Aug 2009 20:01:39 +0000 (22:01 +0200)
committerKristian Rietveld <kris@gtk.org>
Sun, 23 Aug 2009 20:06:16 +0000 (22:06 +0200)
In validate_visible_area() it was assumed that gtk_tree_path_prev()
would always return the correct path of the preceding node.  This is
obviously not true.  The if-clause has been removed so that we now
always use _gtk_tree_view_find_path() to get the path from the tree,
node.

gtk/gtktreeview.c

index 5933f536a0614a386dfababb567e495433183b25..3973bb4b2568e8e871cb3d79cd32d655fe1687d2 100644 (file)
@@ -5988,16 +5988,24 @@ validate_visible_area (GtkTreeView *tree_view)
   while (area_above > 0)
     {
       _gtk_rbtree_prev_full (tree, node, &tree, &node);
-      if (! gtk_tree_path_prev (above_path) && node != NULL)
-       {
-         gtk_tree_path_free (above_path);
-         above_path = _gtk_tree_view_find_path (tree_view, tree, node);
-       }
-      gtk_tree_model_get_iter (tree_view->priv->model, &iter, above_path);
+
+      /* Always find the new path in the tree.  We cannot just assume
+       * a gtk_tree_path_prev() is enough here, as there might be children
+       * in between this node and the previous sibling node.  If this
+       * appears to be a performance hotspot in profiles, we can look into
+       * intrigate logic for keeping path, node and iter in sync like
+       * we do for forward walks.  (Which will be hard because of the lacking
+       * iter_prev).
+       */
 
       if (node == NULL)
        break;
 
+      gtk_tree_path_free (above_path);
+      above_path = _gtk_tree_view_find_path (tree_view, tree, node);
+
+      gtk_tree_model_get_iter (tree_view->priv->model, &iter, above_path);
+
       if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) ||
          GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID))
        {