From 692c50ba672b55d809e12b97184e7ee21d9f3fda Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Fri, 8 May 2009 10:57:56 +0100 Subject: [PATCH] [list-model] Return NULL for first row in a fully filtered model If the filter means that the there should be no rows left in the model, clutter_model_get_iter_at_row (model, 0) should return NULL. Howevever the currene implementation misbehaves and returns a bad iterator. This change resolves the issue by tracking if we actually found any non-filtered rows in our pass through the sequence. OH Bugzilla: 1591 --- clutter/clutter-list-model.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/clutter/clutter-list-model.c b/clutter/clutter-list-model.c index d83dc7988..bca5a47f2 100644 --- a/clutter/clutter-list-model.c +++ b/clutter/clutter-list-model.c @@ -462,6 +462,7 @@ clutter_list_model_get_iter_at_row (ClutterModel *model, if (row == 0) { GSequenceIter *filter_next; + gboolean row_found = FALSE; filter_next = g_sequence_get_begin_iter (sequence); g_assert (filter_next != NULL); @@ -471,10 +472,21 @@ clutter_list_model_get_iter_at_row (ClutterModel *model, retval->seq_iter = filter_next; if (clutter_model_filter_iter (model, CLUTTER_MODEL_ITER (retval))) - break; + { + /* We've found a row that is valid under the filter */ + row_found = TRUE; + break; + } filter_next = g_sequence_iter_next (filter_next); } + + /* Everything has been filtered -> there is no first row */ + if (!row_found) + { + g_object_unref (retval); + return NULL; + } } else {