genlist needs to iterate exactly once over a fixed list when deselcting all items
authorzmike <michael.blumenkrantz@gmail.com>
Sun, 23 Mar 2014 07:10:15 +0000 (03:10 -0400)
committerMike Blumenkrantz <zmike@samsung.com>
Sun, 23 Mar 2014 07:12:06 +0000 (03:12 -0400)
the selected items list can be modified during deselect from the smart callback, which can cause an infinite loop here

@fix

src/lib/elm_genlist.c

index 94af9a0ddaf01586514b7610504f6a1196b086be..b4c965bac1e75669174856943b7b9f1e668128e4 100644 (file)
@@ -2368,10 +2368,14 @@ _item_multi_select_down(Elm_Genlist_Smart_Data *sd)
 static Eina_Bool
 _all_items_deselect(Elm_Genlist_Smart_Data *sd)
 {
+   Eina_List *l;
+   Elm_Object_Item *it;
+
    if (!sd->selected) return EINA_FALSE;
 
-   while (sd->selected)
-     elm_genlist_item_selected_set(sd->selected->data, EINA_FALSE);
+   l = eina_list_clone(sd->selected);
+   EINA_LIST_FREE(l, it)
+     elm_genlist_item_selected_set(it, EINA_FALSE);
 
    return EINA_TRUE;
 }