From 692e28fe74bed71b34de863f32384f7d2076c9ee Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Mon, 5 Jan 2015 20:43:58 +0900 Subject: [PATCH] genlist: Fix genlist index get bug Because not all item block have "max_items_per_block" number of items in it's block. So the calculation is not correct when items are added & removed in each block. Anyhow, we need more efficient way for this API because genlist uses inlinst. --- src/lib/elm_genlist.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index 8d54e94..2c93851 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -7159,12 +7159,16 @@ elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *eo_it) EOLIAN static int _elm_genlist_item_index_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it) { + int cnt = 0; + Elm_Gen_Item *tmp; ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, -1); - if (it->item->block) - return it->position + (it->item->block->position * - GL_IT(it)->wsd->max_items_per_block); - return -1; + EINA_INLIST_FOREACH(GL_IT(it)->wsd->items, tmp) + { + if (tmp == it) break; + cnt++; + } + return cnt; } EOLIAN static void -- 2.7.4