summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzmike <michael.blumenkrantz@gmail.com>2014-03-23 10:37:47 -0400
committerzmike <michael.blumenkrantz@gmail.com>2014-03-23 10:39:47 -0400
commit2cf854752f5dd8462609b2766325359286548b62 (patch)
tree56080e32a4419cbd3f975c242ba27e2fe3129d52
parent90e094d5d69c32ad23acb995bceff41123cd8dcb (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 567c586c1..09e5a7f28 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -2377,14 +2377,16 @@ _item_multi_select_down(Elm_Genlist_Smart_Data *sd)
2377static Eina_Bool 2377static Eina_Bool
2378_all_items_deselect(Elm_Genlist_Smart_Data *sd) 2378_all_items_deselect(Elm_Genlist_Smart_Data *sd)
2379{ 2379{
2380 Eina_List *l;
2381 Elm_Object_Item *it;
2382
2383 if (!sd->selected) return EINA_FALSE; 2380 if (!sd->selected) return EINA_FALSE;
2384 2381
2385 l = eina_list_clone(sd->selected); 2382 sd->deselecting = eina_list_clone(sd->selected);
2386 EINA_LIST_FREE(l, it) 2383 while (sd->deselecting)
2387 elm_genlist_item_selected_set(it, EINA_FALSE); 2384 {
2385 Elm_Object_Item *it = eina_list_data_get(sd->deselecting);
2386
2387 sd->deselecting = eina_list_remove_list(sd->deselecting, sd->deselecting);
2388 elm_genlist_item_selected_set(it, EINA_FALSE);
2389 }
2388 2390
2389 return EINA_TRUE; 2391 return EINA_TRUE;
2390} 2392}
@@ -3286,7 +3288,11 @@ _elm_genlist_item_del_not_serious(Elm_Gen_Item *it)
3286 if (it->walking > 0) return; 3288 if (it->walking > 0) return;
3287 3289
3288 if (it->selected) 3290 if (it->selected)
3289 sd->selected = eina_list_remove(sd->selected, it); 3291 {
3292 sd->selected = eina_list_remove(sd->selected, it);
3293 if (sd->deselecting)
3294 sd->deselecting = eina_list_remove(sd->deselecting, it);
3295 }
3290 if (sd->last_focused_item == (Elm_Object_Item *)it) 3296 if (sd->last_focused_item == (Elm_Object_Item *)it)
3291 sd->last_focused_item = NULL; 3297 sd->last_focused_item = NULL;
3292 if (sd->focused_item == (Elm_Object_Item *)it) 3298 if (sd->focused_item == (Elm_Object_Item *)it)
diff --git a/src/lib/elm_widget_genlist.h b/src/lib/elm_widget_genlist.h
index 5fe7fa236..68da89b4d 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 */