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
This commit is contained in:
Daniel Zaoui 2015-09-26 22:37:03 +03:00
parent b209100870
commit 08e4f0ce8d
1 changed files with 4 additions and 3 deletions

View File

@ -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;