[gtk+] GtkTreeView: Avoid a crash with empty trees



commit d5876e99f59f8ef7404778aee7bdad4e0cb89fd5
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Aug 26 00:05:14 2014 -0400

    GtkTreeView: Avoid a crash with empty trees
    
    The gesture code was assuming that the rb tree exists, which
    will not be the case if the treeview is empty.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735300

 gtk/gtktreeview.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 146d25a..efaabfb 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -3320,6 +3320,12 @@ gtk_tree_view_drag_gesture_begin (GtkGestureDrag *gesture,
   GtkRBTree *tree;
   GtkRBNode *node;
 
+  if (tree_view->priv->tree == NULL)
+    {
+      gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
+      return;
+    }
+
   gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, start_x, start_y,
                                                      &bin_x, &bin_y);
   tree_view->priv->press_start_x = tree_view->priv->rubber_band_x = bin_x;


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