davemds pushed a commit to branch elementary-1.9.

http://git.enlightenment.org/core/elementary.git/commit/?id=fab2d18a50f4d001953d66633005c11d0f729145

commit fab2d18a50f4d001953d66633005c11d0f729145
Author: davemds <[email protected]>
Date:   Sat Aug 9 18:03:31 2014 +0200

    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.
---
 src/lib/elm_genlist.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index b17823c..f1cf589 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -3615,15 +3615,7 @@ _item_mouse_down_cb(void *data,
    else sd->on_hold = EINA_FALSE;
    if (sd->on_hold) return;
    sd->wasselected = it->selected;
-   _item_highlight(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);
@@ -3634,6 +3626,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 *

-- 


Reply via email to