jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=08e4f0ce8d5c08f8e73ce83532bcba275b2e9a74

commit 08e4f0ce8d5c08f8e73ce83532bcba275b2e9a74
Author: Daniel Zaoui <daniel.za...@yahoo.com>
Date:   Sat Sep 26 22:37:03 2015 +0300

    Eo: fix double callback deletion
    
    Scenario:
    - Same signal/function/data registered twice on e.g mouse_down
    - On mouse_down, register mouse_move and mouse_up
    - On mouse_up, unregister mouse_move
    
    Result: mouse_move still invoked after mouse_up
    
    Reason:
    - When the mouse_move callback deletion is required, the cb is
    flagged as deleted but is not freed as walking_list blocks.
    - When the second (and same) has to be deleted, it will try to delete
    the first again because the delete_me flag is not checked.
    
    This patch fixes it by checking the delete_me flag when determining the
    candidate.
    
    @fix
---
 src/lib/eo/eo_base_class.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 77a4bf1..bb01877 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -576,8 +576,8 @@ _eo_base_event_callback_del(Eo *obj, Eo_Base_Data *pd,
 
    for (cb = pd->callbacks; cb; cb = cb->next)
      {
-        if ((cb->items.item.desc == desc) && (cb->items.item.func == func) &&
-              (cb->func_data == user_data))
+        if (!cb->delete_me && (cb->items.item.desc == desc) &&
+              (cb->items.item.func == func) && (cb->func_data == user_data))
           {
              const Eo_Callback_Array_Item arr[] = { {desc, func}, {NULL, 
NULL}};
 
@@ -622,7 +622,8 @@ _eo_base_event_callback_array_del(Eo *obj, Eo_Base_Data *pd,
 
    for (cb = pd->callbacks; cb; cb = cb->next)
      {
-        if ((cb->items.item_array == array) && (cb->func_data == user_data))
+        if (!cb->delete_me &&
+              (cb->items.item_array == array) && (cb->func_data == user_data))
           {
              cb->delete_me = EINA_TRUE;
              pd->deletions_waiting = EINA_TRUE;

-- 


Reply via email to