]> Pileus Git - ~andy/gtk/commitdiff
treeview: Fix comparison to catch all cases
authorBenjamin Otte <otte@redhat.com>
Tue, 24 Jan 2012 14:44:03 +0000 (15:44 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 24 Jan 2012 16:55:14 +0000 (17:55 +0100)
Otherwise, we could sometimes fail to update the cursor node when the
right row was deleted.

Also, I'd like to file a formal complaint that this node/tree
differentiation makes writing comparisons too complicated.

https://bugzilla.gnome.org/show_bug.cgi?id=668169

gtk/gtktreeview.c

index 72564854f9539e2679f8372e88f815bf82c44933..993a41b11060df2bf0dcc2f2070bee44c69e2e19 100644 (file)
@@ -9025,7 +9025,8 @@ gtk_tree_view_row_deleted (GtkTreeModel *model,
   /* If the cursor row got deleted, move the cursor to the next row */
   if (tree_view->priv->cursor_node &&
       (tree_view->priv->cursor_node == node ||
-       (node->children &&  _gtk_rbtree_contains (node->children, tree_view->priv->cursor_tree))))
+       (node->children && (tree_view->priv->cursor_tree == node->children ||
+                           _gtk_rbtree_contains (node->children, tree_view->priv->cursor_tree)))))
     {
       GtkTreePath *cursor_path;