[gtk+/gtk-2-24] Fix a sporadic segfault in treeview keynav



commit dd882f5b8033286c0e24883569527953f8ee08fa
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Aug 10 00:31:46 2010 -0400

    Fix a sporadic segfault in treeview keynav
    
    If a a treeview has frequent periodic additions and removals of
    rows, it is possible that a page down keypress moves the cursor
    out of the height of the treeview. In some of these cases, we
    can be tricked into dereferencing a  NULL pointer.
    
    Bug 612919.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746269

 gtk/gtktreeview.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index f63419f..89301eb 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -9837,6 +9837,13 @@ gtk_tree_view_move_cursor_page_up_down (GtkTreeView *tree_view,
     _gtk_rbtree_find_offset (tree_view->priv->tree, y,
                             &cursor_tree, &cursor_node);
 
+  if (cursor_tree == NULL)
+    {
+      /* FIXME: we lost the cursor.  Should we try to get one? */
+      gtk_tree_path_free (old_cursor_path);
+      return;
+    }
+
   if (tree_view->priv->cursor_offset > BACKGROUND_HEIGHT (cursor_node))
     {
       _gtk_rbtree_next_full (cursor_tree, cursor_node,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]