summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorSoeren Sandmann <sandmann@daimi.au.dk>2004-08-22 12:03:46 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2004-08-22 12:03:46 +0000
commit9c34ec2ee47e26fe7c69c5013296007b73f73087 (patch)
treef9a0de21cb92c850698509927eb45bfe49bf0607 /gtk
parent6b4ef37ccc407fdcd7d9a92cfc0d903359f772ed (diff)
downloadgtk+-9c34ec2ee47e26fe7c69c5013296007b73f73087.tar.gz
Normalize the position so we don't create paths with off-list indices.
Sun Aug 22 13:32:33 2004 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtkliststore.c (gtk_list_store_insert): Normalize the position so we don't create paths with off-list indices. (#150320).
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkliststore.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gtk/gtkliststore.c b/gtk/gtkliststore.c
index 95700acc9a..3a8c8e0e10 100644
--- a/gtk/gtkliststore.c
+++ b/gtk/gtkliststore.c
@@ -970,6 +970,7 @@ gtk_list_store_insert (GtkListStore *list_store,
GtkTreePath *path;
GtkSequence *seq;
GtkSequencePtr ptr;
+ gint length;
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
@@ -979,6 +980,10 @@ gtk_list_store_insert (GtkListStore *list_store,
seq = list_store->seq;
+ length = _gtk_sequence_get_length (seq);
+ if (position > length)
+ position = length;
+
ptr = _gtk_sequence_get_ptr_at_pos (seq, position);
ptr = _gtk_sequence_insert (ptr, NULL);