summaryrefslogtreecommitdiff
path: root/gtk/gtktreeview.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-08-26 00:05:14 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-08-26 00:06:23 -0400
commitd5876e99f59f8ef7404778aee7bdad4e0cb89fd5 (patch)
tree48158c3983a3ab15901557db3516c72ca1489b31 /gtk/gtktreeview.c
parent318555ca268104640a75d6740704ea33172f491d (diff)
downloadgtk+-d5876e99f59f8ef7404778aee7bdad4e0cb89fd5.tar.gz
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
Diffstat (limited to 'gtk/gtktreeview.c')
-rw-r--r--gtk/gtktreeview.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 146d25ae5d..efaabfb33c 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;