genlist: refactoring item deletion process
authorSangHyeon Jade Lee <sh10233.lee@samsung.com>
Mon, 2 Mar 2020 09:35:09 +0000 (18:35 +0900)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 3 Mar 2020 21:24:59 +0000 (06:24 +0900)
sd->items must be cleaned before some item deletion process,
so that adjust item cannot find deleted item on sd->items list.

Change-Id: I3f862cc9d5b39291d7febcfcdfb4efbfe3937753

src/lib/elementary_tizen/elm_genlist.c

index 30f9028..9cbb468 100644 (file)
@@ -7865,13 +7865,14 @@ _item_free(Elm_Gen_Item *it)
    if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
       sd->group_items = eina_list_remove(sd->group_items, it);
 
+   sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(it));
+   sd->item_count--;
+
    if (it->selected)
       {
          sd->selected = eina_list_remove(sd->selected, EO_OBJ(it));
          it->selected = EINA_FALSE;
       }
-   if (sd->show_item == it) sd->show_item = NULL;
-
    if ((sd->g_item) && (sd->g_item == it)) sd->g_item = NULL;
    if (sd->expanded_item == it) sd->expanded_item = NULL;
    if (sd->state) ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free);
@@ -7941,11 +7942,9 @@ end:
 
    _item_unrealize(it, EINA_FALSE);
 
+   if (sd->show_item == it) sd->show_item = NULL;
    if (sd->aligned_item == it) sd->aligned_item = NULL;
 
-   sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(it));
-   sd->item_count--;
-
    if (it->item->proxy)
      {
         evas_object_smart_member_del(it->item->proxy);