summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzmike <michael.blumenkrantz@gmail.com>2014-03-23 10:37:47 -0400
committerMike Blumenkrantz <zmike@samsung.com>2014-03-23 10:41:45 -0400
commitb0089c7017025f9e6cf5b7e8d8e7be5206929934 (patch)
treefcf1603ee7bf1e19eaa899485cecf6cabc981237
parented2dd62702ce5c63b2a6bc31fa5ac95c757489f4 (diff)
genlist no longer crashes if a selected item is deleted during deselect_all
-rw-r--r--src/lib/elm_genlist.c20
-rw-r--r--src/lib/elm_widget_genlist.h1
2 files changed, 14 insertions, 7 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index b4c965bac..ca933e14b 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -2368,14 +2368,16 @@ _item_multi_select_down(Elm_Genlist_Smart_Data *sd)
2368static Eina_Bool 2368static Eina_Bool
2369_all_items_deselect(Elm_Genlist_Smart_Data *sd) 2369_all_items_deselect(Elm_Genlist_Smart_Data *sd)
2370{ 2370{
2371 Eina_List *l;
2372 Elm_Object_Item *it;
2373
2374 if (!sd->selected) return EINA_FALSE; 2371 if (!sd->selected) return EINA_FALSE;
2375 2372
2376 l = eina_list_clone(sd->selected); 2373 sd->deselecting = eina_list_clone(sd->selected);
2377 EINA_LIST_FREE(l, it) 2374 while (sd->deselecting)
2378 elm_genlist_item_selected_set(it, EINA_FALSE); 2375 {
2376 Elm_Object_Item *it = eina_list_data_get(sd->deselecting);
2377
2378 sd->deselecting = eina_list_remove_list(sd->deselecting, sd->deselecting);
2379 elm_genlist_item_selected_set(it, EINA_FALSE);
2380 }
2379 2381
2380 return EINA_TRUE; 2382 return EINA_TRUE;
2381} 2383}
@@ -3067,7 +3069,11 @@ _elm_genlist_item_del_not_serious(Elm_Gen_Item *it)
3067 if (it->walking > 0) return; 3069 if (it->walking > 0) return;
3068 3070
3069 if (it->selected) 3071 if (it->selected)
3070 sd->selected = eina_list_remove(sd->selected, it); 3072 {
3073 sd->selected = eina_list_remove(sd->selected, it);
3074 if (sd->deselecting)
3075 sd->deselecting = eina_list_remove(sd->deselecting, it);
3076 }
3071 3077
3072 if (it->itc->func.del) 3078 if (it->itc->func.del)
3073 it->itc->func.del((void *)it->base.data, WIDGET(it)); 3079 it->itc->func.del((void *)it->base.data, WIDGET(it));
diff --git a/src/lib/elm_widget_genlist.h b/src/lib/elm_widget_genlist.h
index 4ac52c2a3..a0010b9d3 100644
--- a/src/lib/elm_widget_genlist.h
+++ b/src/lib/elm_widget_genlist.h
@@ -38,6 +38,7 @@ struct _Elm_Genlist_Smart_Data
38 Eina_List *selected; /* a list of 38 Eina_List *selected; /* a list of
39 * selected 39 * selected
40 * items */ 40 * items */
41 Eina_List *deselecting; /* a list of items currently being deselected */
41 Eina_List *group_items; /* a list of 42 Eina_List *group_items; /* a list of
42 * groups index 43 * groups index
43 * items */ 44 * items */