summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-08-09 17:57:46 +0200
committerdavemds <dave@gurumeditation.it>2014-08-09 17:57:46 +0200
commitc054aee20ed57d01e3aed347576d3534baa3c6aa (patch)
tree0c7dd35723cc74303318b33eafa476ec3c81aec1
parent4aefb91c58f3b4bf795f7b2814dd2f2eafa75305 (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 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,
3858 else sd->on_hold = EINA_FALSE; 3858 else sd->on_hold = EINA_FALSE;
3859 if (sd->on_hold) return; 3859 if (sd->on_hold) return;
3860 sd->wasselected = it->selected; 3860 sd->wasselected = it->selected;
3861 it->highlight_cb(it); 3861
3862 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
3863 if ((!elm_widget_item_disabled_get(it)) &&
3864 (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
3865 {
3866 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
3867 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
3868 }
3869 evas_object_smart_callback_call(WIDGET(it), SIG_PRESSED, it);
3870 ecore_timer_del(it->item->swipe_timer); 3862 ecore_timer_del(it->item->swipe_timer);
3871 it->item->swipe_timer = ecore_timer_add(SWIPE_TIME, _swipe_cancel, it); 3863 it->item->swipe_timer = ecore_timer_add(SWIPE_TIME, _swipe_cancel, it);
3872 ELM_SAFE_FREE(it->long_timer, ecore_timer_del); 3864 ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
@@ -3877,6 +3869,19 @@ _item_mouse_down_cb(void *data,
3877 it->long_timer = NULL; 3869 it->long_timer = NULL;
3878 sd->swipe = EINA_FALSE; 3870 sd->swipe = EINA_FALSE;
3879 sd->movements = 0; 3871 sd->movements = 0;
3872
3873 // and finally call the user callbacks.
3874 // NOTE: keep this code at the bottom, as the user can change the
3875 // list at this point (clear, delete, etc...)
3876 it->highlight_cb(it);
3877 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
3878 if ((!elm_widget_item_disabled_get(it)) &&
3879 (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
3880 {
3881 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
3882 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
3883 }
3884 evas_object_smart_callback_call(WIDGET(it), SIG_PRESSED, it);
3880} 3885}
3881 3886
3882static Item_Block * 3887static Item_Block *