summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2009-08-23 22:01:39 +0200
committerKristian Rietveld <kris@gtk.org>2009-08-23 22:06:16 +0200
commit4449acbb82ece37acbf6189e43c3d75240a54052 (patch)
treed1a2c913b8c0ba9df7a3fad524e0a88220de5547 /gtk
parent7b4f09a589de2abae42fab87805e468e467b8c50 (diff)
downloadgtk+-4449acbb82ece37acbf6189e43c3d75240a54052.tar.gz
Remove broken logic in backwards walks in validate_visible_area()
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.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtktreeview.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 5933f536a0..3973bb4b25 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -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))
{