diff options
author | davemds <dave@gurumeditation.it> | 2014-08-09 17:57:46 +0200 |
---|---|---|
committer | davemds <dave@gurumeditation.it> | 2014-08-09 17:57:46 +0200 |
commit | c054aee20ed57d01e3aed347576d3534baa3c6aa (patch) | |
tree | 0c7dd35723cc74303318b33eafa476ec3c81aec1 | |
parent | 4aefb91c58f3b4bf795f7b2814dd2f2eafa75305 (diff) | |
download | elementary-c054aee20ed57d01e3aed347576d3534baa3c6aa.tar.gz |
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.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index 34a2a4ef9..60c0fb548 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -3858,15 +3858,7 @@ _item_mouse_down_cb(void *data, else sd->on_hold = EINA_FALSE; if (sd->on_hold) return; sd->wasselected = it->selected; - it->highlight_cb(it); - if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) - if ((!elm_widget_item_disabled_get(it)) && - (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)) - { - evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it); - evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it); - } - evas_object_smart_callback_call(WIDGET(it), SIG_PRESSED, it); + ecore_timer_del(it->item->swipe_timer); it->item->swipe_timer = ecore_timer_add(SWIPE_TIME, _swipe_cancel, it); ELM_SAFE_FREE(it->long_timer, ecore_timer_del); @@ -3877,6 +3869,19 @@ _item_mouse_down_cb(void *data, it->long_timer = NULL; sd->swipe = EINA_FALSE; sd->movements = 0; + + // and finally call the user callbacks. + // NOTE: keep this code at the bottom, as the user can change the + // list at this point (clear, delete, etc...) + it->highlight_cb(it); + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + if ((!elm_widget_item_disabled_get(it)) && + (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)) + { + evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it); + evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it); + } + evas_object_smart_callback_call(WIDGET(it), SIG_PRESSED, it); } static Item_Block * |