From adca81e9668338d1fae54ad135c2f3343f33887f Mon Sep 17 00:00:00 2001 From: Yun ilkook Date: Mon, 23 May 2011 15:21:06 +0900 Subject: [PATCH] [store] add debug point and fix the eina list paremeter set Change-Id: I8f88a500e292ce5c5448c1e1b0eecf78ba7a3ea3 --- debian/changelog | 8 +++ src/lib/elm_store.c | 158 +++++++++++++++++++++++++++++++++++----------------- 2 files changed, 115 insertions(+), 51 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9891216..941d1c8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +elementary (1.0.0+svn.58393slp2+build09) unstable; urgency=low + + * [Store] add debug pointe and fix the eina list parameter set + * Git: 165.213.180.234:/slp/pkgs/e/elementary + * Tag: elementary_1.0.0+svn.58393slp2+build09 + + -- Ilkook Yun Mon, 23 May 2011 15:19:30 +0900 + elementary (1.0.0+svn.58393slp2+build08) unstable; urgency=low * [Navigationbar] updated title clicked events diff --git a/src/lib/elm_store.c b/src/lib/elm_store.c index 8e6cb1e..472097b 100644 --- a/src/lib/elm_store.c +++ b/src/lib/elm_store.c @@ -642,6 +642,7 @@ elm_store_free(Elm_Store *st) } else { + printf("[store_debug][%s][%d]\n",__FUNCTION__,__LINE__); st->live = EINA_FALSE; Eina_List *l; Eina_List *l_next; @@ -670,7 +671,7 @@ elm_store_free(Elm_Store *st) if (sti->fetched) { int index = elm_store_item_index_get(sti); - _item_unfetch(st, index); + if (index != -1) _item_unfetch(st, index); } LKD(sti->lock); // free(sti); @@ -679,6 +680,7 @@ elm_store_free(Elm_Store *st) } } eina_list_free(st->header_items); + printf("[store_debug][%s][%d]\n",__FUNCTION__,__LINE__); if (st->genlist) { @@ -972,6 +974,7 @@ _item_fetch(Elm_Store *st, int index) { if ((in_index + eina_list_count(header_list)) > index) { + if( index - in_index < 0 ) printf("[store_debug][%s][%d][index = %d]\n",__FUNCTION__,__LINE__,index); sti = eina_list_nth(header_list, index - in_index); if(sti) { @@ -1033,8 +1036,9 @@ _item_unfetch(Elm_Store *st, int index) { if(header_list) { - if ((in_index + (signed)eina_list_count(header_list)) > index) + if ((in_index + eina_list_count(header_list)) > index) { + if( index - in_index < 0 ) printf("[store_debug][%s][%d][index = %d]\n",__FUNCTION__,__LINE__,index); sti = eina_list_nth(header_list, index - in_index); if(sti) { @@ -1095,42 +1099,49 @@ _item_realize(Elm_Store_Item *sti) { int index = elm_store_item_index_get(sti); - if ((st->start_fetch_index <= index) && (index <= (st->start_fetch_index + st->cache_max))) + if (index != -1) { - if (sti->fetched) + if ((st->start_fetch_index <= index) && (index <= (st->start_fetch_index + st->cache_max))) { - _item_unfetch(st, index); - } - _item_fetch(st, index); + if (sti->fetched) + { + _item_unfetch(st, index); + } + _item_fetch(st, index); - if(st->end_fetch_index < index) + if(st->end_fetch_index < index) + { + st->end_fetch_index = index; + } + } + else if (st->start_fetch_index > index) { - st->end_fetch_index = index; + int diff = st->start_fetch_index - index; + int loop; + for (loop = 1; loop <= diff; loop++) + { + _item_unfetch(st, st->end_fetch_index); + st->end_fetch_index--; + _item_fetch(sti->store, (st->start_fetch_index - loop)); + } + st->start_fetch_index = index; } - } - else if (st->start_fetch_index > index) - { - int diff = st->start_fetch_index - index; - int loop; - for (loop = 1; loop <= diff; loop++) + else if (index > st->end_fetch_index) { - _item_unfetch(st, st->end_fetch_index); - st->end_fetch_index--; - _item_fetch(sti->store, (st->start_fetch_index - loop)); + int diff = index - st->end_fetch_index; + int loop; + for (loop = 1; loop <= diff; loop++) + { + _item_unfetch(st, st->start_fetch_index); + st->start_fetch_index++; + _item_fetch(st, (st->end_fetch_index + loop)); + } + st->end_fetch_index = index; } - st->start_fetch_index = index; } - else if (index > st->end_fetch_index) + else { - int diff = index - st->end_fetch_index; - int loop; - for (loop = 1; loop <= diff; loop++) - { - _item_unfetch(st, st->start_fetch_index); - st->start_fetch_index++; - _item_fetch(st, (st->end_fetch_index + loop)); - } - st->end_fetch_index = index; + return; } } } @@ -1633,7 +1644,14 @@ _normal_item_append(Elm_Store_Item *sti, Elm_Genlist_Item_Class *itc) if (remove_item->fetched) { int index = elm_store_item_index_get(remove_item); - _item_unfetch(st, index); + if (index != -1) + { + _item_unfetch(st, index); + } + else + { + return; + } } Eina_List *temp_header_list = header_list; header_list = eina_list_remove(header_list, remove_item); @@ -1659,7 +1677,14 @@ _normal_item_append(Elm_Store_Item *sti, Elm_Genlist_Item_Class *itc) if (temp_sti->fetched) { int index = elm_store_item_index_get(temp_sti); - _item_unfetch(st, index); + if (index != -1) + { + _item_unfetch(st, index); + } + else + { + return; + } } header_list = eina_list_remove(header_list, temp_sti); st->total_item_count--; @@ -1723,6 +1748,7 @@ _normal_item_append(Elm_Store_Item *sti, Elm_Genlist_Item_Class *itc) } else { + if( (eina_list_count(header_list) - 1) < 0 ) printf("[store_debug][%s][%d][eina_list_count(header_list) = %d]\n",__FUNCTION__,__LINE__,eina_list_count(header_list)); Elm_Store_Item *last_sti = eina_list_nth(header_list, eina_list_count(header_list) - 1); sti->item_info->index = eina_list_count(header_list); header_list = eina_list_append(header_list, sti); @@ -1744,6 +1770,7 @@ _normal_item_append(Elm_Store_Item *sti, Elm_Genlist_Item_Class *itc) } if(last_add) { + if( (eina_list_count(header_list) - 1) < 0 ) printf("[store_debug][%s][%d][eina_list_count(header_list) = %d]\n",__FUNCTION__,__LINE__,eina_list_count(header_list)); Elm_Store_Item *last_sti = eina_list_nth(header_list, eina_list_count(header_list) - 1); sti->item_info->index = eina_list_count(header_list); header_list = eina_list_append(header_list, sti); @@ -1822,6 +1849,7 @@ _normal_item_append(Elm_Store_Item *sti, Elm_Genlist_Item_Class *itc) } else { + if( (eina_list_count(header_list) - 1) < 0 ) printf("[store_debug][%s][%d][eina_list_count(header_list) = %d]\n",__FUNCTION__,__LINE__,eina_list_count(header_list)); Elm_Store_Item *last_sti = eina_list_nth(header_list, eina_list_count(header_list) - 1); sti->item_info->index = eina_list_count(header_list); header_list = eina_list_append(header_list, sti); @@ -1843,6 +1871,7 @@ _normal_item_append(Elm_Store_Item *sti, Elm_Genlist_Item_Class *itc) } if(normal_add) { + if( (eina_list_count(header_list) - 1) < 0 ) printf("[store_debug][%s][%d][eina_list_count(header_list) = %d]\n",__FUNCTION__,__LINE__,eina_list_count(header_list)); Elm_Store_Item *last_sti = eina_list_nth(header_list, eina_list_count(header_list) - 1); sti->item_info->index = eina_list_count(header_list); header_list = eina_list_append(header_list, sti); @@ -2288,13 +2317,19 @@ elm_store_visible_items_update(Elm_Store *st) { Elm_Store_Item *realized_sti = elm_genlist_item_data_get(it); int index = elm_store_item_index_get(realized_sti); - - if(realized_sti->fetched) + if (index != -1) { - _item_unfetch(st, index); + if(realized_sti->fetched) + { + _item_unfetch(st, index); + } + _item_fetch(st, index); + if (realized_sti->data) elm_genlist_item_update(realized_sti->item); + } + else + { + return; } - _item_fetch(st, index); - if (realized_sti->data) elm_genlist_item_update(realized_sti->item); } } } @@ -2315,26 +2350,33 @@ elm_store_item_update(Elm_Store_Item *sti) Elm_Store *st = sti->store; int index = elm_store_item_index_get(sti); - if ((st->start_fetch_index <= index) && (index <= (st->start_fetch_index + st->cache_max))) + if (index != -1) { - if (sti->fetched) - { - _item_unfetch(st, index); - } - _item_fetch(st, index); - - if(st->end_fetch_index < (st->total_item_count-1)) + if ((st->start_fetch_index <= index) && (index <= (st->start_fetch_index + st->cache_max))) { - if( (st->end_fetch_index - st->cache_max) == st->start_fetch_index) + if (sti->fetched) { - _item_unfetch(st, (st->total_item_count-1)); + _item_unfetch(st, index); } - else + _item_fetch(st, index); + + if(st->end_fetch_index < (st->total_item_count-1)) { - st->end_fetch_index = (st->total_item_count-1); + if( (st->end_fetch_index - st->cache_max) == st->start_fetch_index) + { + _item_unfetch(st, (st->total_item_count-1)); + } + else + { + st->end_fetch_index = (st->total_item_count-1); + } } + if(sti->data) elm_genlist_item_update(sti->item); } - if(sti->data) elm_genlist_item_update(sti->item); + } + else + { + return; } } @@ -2389,7 +2431,14 @@ elm_store_item_del(Elm_Store_Item *sti) if (remove_sti->fetched) { int index = elm_store_item_index_get(remove_sti); - _item_unfetch(st, index); + if (index != -1) + { + _item_unfetch(st, index); + } + else + { + return; + } } Eina_List *temp_header_list = header_list; header_list = eina_list_remove(header_list, remove_sti); @@ -2415,7 +2464,14 @@ elm_store_item_del(Elm_Store_Item *sti) if (temp_sti->fetched) { int index = elm_store_item_index_get(temp_sti); - _item_unfetch(st, index); + if (index != -1) + { + _item_unfetch(st, index); + } + else + { + return; + } } header_list = eina_list_remove(header_list, temp_sti); st->total_item_count--; -- 2.7.4