[gtk+/gtk-2-16] Make gtk_tree_view_real_set_cursor() handle non-existing paths
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-16] Make gtk_tree_view_real_set_cursor() handle non-existing paths
- Date: Sat, 29 Aug 2009 02:44:38 +0000 (UTC)
commit 876c05148d3819ace4186171ba7cae300c4da9c3
Author: Kristian Rietveld <kris gtk org>
Date: Fri Aug 28 09:53:49 2009 +0200
Make gtk_tree_view_real_set_cursor() handle non-existing paths
Such paths (eg. a child node that is collapsed) should be ignored. This
is fixed by checking the return value of _gtk_tree_view_find_node(),
which returns a partial return value (the parent node) when it returns
TRUE.
gtk/gtktreeview.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index c73f439..1bf746e 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -12558,14 +12558,24 @@ gtk_tree_view_real_set_cursor (GtkTreeView *tree_view,
gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = NULL;
- /* One cannot set the cursor on a separator. */
- if (!row_is_separator (tree_view, NULL, path))
+ /* One cannot set the cursor on a separator. Also, if
+ * _gtk_tree_view_find_node returns TRUE, it ran out of tree
+ * before finding the tree and node belonging to path. The
+ * path maps to a non-existing path and we will silently bail out.
+ * We unset tree and node to avoid further processing.
+ */
+ if (!row_is_separator (tree_view, NULL, path)
+ && _gtk_tree_view_find_node (tree_view, path, &tree, &node) == FALSE)
{
tree_view->priv->cursor =
- gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view),
- tree_view->priv->model,
- path);
- _gtk_tree_view_find_node (tree_view, path, &tree, &node);
+ gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view),
+ tree_view->priv->model,
+ path);
+ }
+ else
+ {
+ tree = NULL;
+ node = NULL;
}
if (tree != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]