From 4b55066a97dcc2af13790527455bcd13256ae03f Mon Sep 17 00:00:00 2001 From: Taehyub Kim Date: Mon, 14 Sep 2020 19:48:27 +0900 Subject: [PATCH] elm_dnd: clean up the registered target object when elm_drop_target_del API is called @fix Change-Id: Idbe9d1412093c25e3fa4b20e537d17f70ac5556b --- src/lib/elementary/efl_ui_dnd.c | 18 ++++++++++++++++++ src/lib/elementary/elm_dnd.c | 1 - 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_dnd.c b/src/lib/elementary/efl_ui_dnd.c index 7a765cd..4d294ff 100644 --- a/src/lib/elementary/efl_ui_dnd.c +++ b/src/lib/elementary/efl_ui_dnd.c @@ -150,8 +150,26 @@ _efl_ui_dnd_efl_object_event_callback_array_priority_add(Eo *obj, Efl_Ui_Dnd_Dat return efl_event_callback_array_priority_add(efl_super(obj, EFL_UI_DND_MIXIN), array, priority, user_data); } +EOLIAN static Eina_Bool +_efl_ui_dnd_efl_object_event_callback_array_del(Eo *obj, Efl_Ui_Dnd_Data *pd, + const Efl_Callback_Array_Item *array, + const void *user_data) +{ + for (int i = 0; array[i].desc; ++i) + { + if (IS_DROP_EVENT(array[i].desc) && pd->registered) + { + pd->registered = EINA_FALSE; + _drop_event_unregister(obj); + } + } + return efl_event_callback_array_del(efl_super(obj, EFL_UI_DND_MIXIN), array, user_data); +} + + #define EFL_UI_DND_EXTRA_OPS \ EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _efl_ui_dnd_efl_object_event_callback_priority_add), \ EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _efl_ui_dnd_efl_object_event_callback_array_priority_add), \ + EFL_OBJECT_OP_FUNC(efl_event_callback_array_del, _efl_ui_dnd_efl_object_event_callback_array_del), \ #include "efl_ui_dnd.eo.c" diff --git a/src/lib/elementary/elm_dnd.c b/src/lib/elementary/elm_dnd.c index d0c309a..2f2ad00 100644 --- a/src/lib/elementary/elm_dnd.c +++ b/src/lib/elementary/elm_dnd.c @@ -228,7 +228,6 @@ elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format format, efl_event_callback_array_del(obj, drop_target_cb(), eina_list_data_get(found)); eina_hash_list_remove(target_register, &obj, target); eina_array_free(target->mime_types); - _drop_event_unregister(obj); //this is ensuring that we are also supporting none widgets free(target); } -- 2.7.4