[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
This commit is contained in:
parent
2ae9d84a2a
commit
692c50ba67
@ -462,6 +462,7 @@ clutter_list_model_get_iter_at_row (ClutterModel *model,
|
|||||||
if (row == 0)
|
if (row == 0)
|
||||||
{
|
{
|
||||||
GSequenceIter *filter_next;
|
GSequenceIter *filter_next;
|
||||||
|
gboolean row_found = FALSE;
|
||||||
|
|
||||||
filter_next = g_sequence_get_begin_iter (sequence);
|
filter_next = g_sequence_get_begin_iter (sequence);
|
||||||
g_assert (filter_next != NULL);
|
g_assert (filter_next != NULL);
|
||||||
@ -471,10 +472,21 @@ clutter_list_model_get_iter_at_row (ClutterModel *model,
|
|||||||
retval->seq_iter = filter_next;
|
retval->seq_iter = filter_next;
|
||||||
|
|
||||||
if (clutter_model_filter_iter (model, CLUTTER_MODEL_ITER (retval)))
|
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);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user