summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-08-09 18:03:31 +0200
committerdavemds <dave@gurumeditation.it>2014-08-09 18:03:31 +0200
commitfab2d18a50f4d001953d66633005c11d0f729145 (patch)
tree2d999c0da18b192fba4d74d9849725cf6b452a77
parenta85581e4635352c91b986e55cc2a575aa360d075 (diff)
Genlist: do not segv if the user clear the list on item double-click
@fix moved the user callbacks call at the end of the function, so the user is able to modify the list without making the code below the call to fail miserably.
-rw-r--r--src/lib/elm_genlist.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index b17823ccf..f1cf589dd 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -3615,15 +3615,7 @@ _item_mouse_down_cb(void *data,
3615 else sd->on_hold = EINA_FALSE; 3615 else sd->on_hold = EINA_FALSE;
3616 if (sd->on_hold) return; 3616 if (sd->on_hold) return;
3617 sd->wasselected = it->selected; 3617 sd->wasselected = it->selected;
3618 _item_highlight(it); 3618
3619 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
3620 if ((!elm_widget_item_disabled_get(it)) &&
3621 (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
3622 {
3623 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
3624 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
3625 }
3626 evas_object_smart_callback_call(WIDGET(it), SIG_PRESSED, it);
3627 ecore_timer_del(it->item->swipe_timer); 3619 ecore_timer_del(it->item->swipe_timer);
3628 it->item->swipe_timer = ecore_timer_add(SWIPE_TIME, _swipe_cancel, it); 3620 it->item->swipe_timer = ecore_timer_add(SWIPE_TIME, _swipe_cancel, it);
3629 ELM_SAFE_FREE(it->long_timer, ecore_timer_del); 3621 ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
@@ -3634,6 +3626,19 @@ _item_mouse_down_cb(void *data,
3634 it->long_timer = NULL; 3626 it->long_timer = NULL;
3635 sd->swipe = EINA_FALSE; 3627 sd->swipe = EINA_FALSE;
3636 sd->movements = 0; 3628 sd->movements = 0;
3629
3630 // and finally call the user callbacks.
3631 // NOTE: keep this code at the bottom, as the user can change the
3632 // list at this point (clear, delete, etc...)
3633 it->highlight_cb(it);
3634 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
3635 if ((!elm_widget_item_disabled_get(it)) &&
3636 (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
3637 {
3638 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
3639 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
3640 }
3641 evas_object_smart_callback_call(WIDGET(it), SIG_PRESSED, it);
3637} 3642}
3638 3643
3639static Item_Block * 3644static Item_Block *