davemds pushed a commit to branch elementary-1.10.

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

commit c054aee20ed57d01e3aed347576d3534baa3c6aa
Author: davemds <[email protected]>
Date:   Sat Aug 9 17:57:46 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 34a2a4e..60c0fb5 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 *

-- 


Reply via email to