diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2015-03-10 08:26:34 +0000 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2015-03-11 11:24:29 +0000 |
commit | 52858f709c79e4e8ff351240d724d1eafa2f4605 (patch) | |
tree | c7b2607dc3b93b5314446fdfba990a09341963f1 /gtk/gtktreeselection.c | |
parent | d65ccf96ee43e3cd62a705074d452f9f87912ee2 (diff) | |
download | gtk+-52858f709c79e4e8ff351240d724d1eafa2f4605.tar.gz |
gtktreeselection: Fix an abort on selecting an invalid range
gtk_tree_selection_real_modify_range() has a g_return_if_fail() if the
start or end paths passed to it do not correspond to real tree nodes.
However, GtkTreePaths inherently do not have to be valid, so it should
be acceptable to call gtk_tree_selection_select_range() with
non-existent paths. Replace the g_return_if_fail() by a silent return,
and add a unit test.
https://bugzilla.gnome.org/show_bug.cgi?id=712760
Diffstat (limited to 'gtk/gtktreeselection.c')
-rw-r--r-- | gtk/gtktreeselection.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c index 1f6ae9b7e6..b04bcc3e31 100644 --- a/gtk/gtktreeselection.c +++ b/gtk/gtktreeselection.c @@ -1337,8 +1337,9 @@ gtk_tree_selection_real_modify_range (GtkTreeSelection *selection, break; } - g_return_val_if_fail (start_node != NULL, FALSE); - g_return_val_if_fail (end_node != NULL, FALSE); + /* Invalid start or end node? */ + if (start_node == NULL || end_node == NULL) + return dirty; if (anchor_path) _gtk_tree_view_set_anchor_path (priv->tree_view, anchor_path); |