From f7a7a29cc04102952d08085e71ef151c0d521af5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 28 Sep 2017 16:45:45 +0900 Subject: [PATCH] evas: Give a parent to duplicated event objects This comes back to an earlier situation where the fake event objects created by efl_input_dup() had a parent (it should be the evas or maybe the window). But that led to issues as efl_unref() would print error messages. Using efl_allow_parent_unref_set() we hide the error message, because in this situation we want the caller to use efl_unref() and not efl_del() (eg. think of bindings...). See d3436af616319f1fdbbd4a0aa71a7835a14699ac See 6bed255fc4bbe1b30c960339e8dda2fc6e7925cd See 96d94e0076773d6b29107035dc61f5df01a3347f <-- main commit --- src/lib/evas/canvas/efl_input_focus.c | 3 ++- src/lib/evas/canvas/efl_input_hold.c | 3 ++- src/lib/evas/canvas/efl_input_key.c | 3 ++- src/lib/evas/canvas/efl_input_pointer.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/evas/canvas/efl_input_focus.c b/src/lib/evas/canvas/efl_input_focus.c index cc8e64aa0a..9350aedb51 100644 --- a/src/lib/evas/canvas/efl_input_focus.c +++ b/src/lib/evas/canvas/efl_input_focus.c @@ -117,7 +117,8 @@ _efl_input_focus_efl_input_event_dup(Eo *obj EINA_UNUSED, Efl_Input_Focus_Data * Efl_Input_Focus_Data *ev; Efl_Input_Focus *evt; - evt = efl_add(MY_CLASS, NULL); + evt = efl_add(MY_CLASS, efl_parent_get(obj), + efl_allow_parent_unref_set(efl_added, EINA_TRUE)); ev = efl_data_scope_get(evt, MY_CLASS); if (!ev) return NULL; diff --git a/src/lib/evas/canvas/efl_input_hold.c b/src/lib/evas/canvas/efl_input_hold.c index beca304098..8f84793ec5 100644 --- a/src/lib/evas/canvas/efl_input_hold.c +++ b/src/lib/evas/canvas/efl_input_hold.c @@ -106,7 +106,8 @@ _efl_input_hold_efl_input_event_dup(Eo *obj EINA_UNUSED, Efl_Input_Hold_Data *pd Efl_Input_Hold_Data *ev; Efl_Input_Hold *evt; - evt = efl_add(MY_CLASS, NULL); + evt = efl_add(MY_CLASS, efl_parent_get(obj), + efl_allow_parent_unref_set(efl_added, EINA_TRUE)); ev = efl_data_scope_get(evt, MY_CLASS); if (!ev) return NULL; diff --git a/src/lib/evas/canvas/efl_input_key.c b/src/lib/evas/canvas/efl_input_key.c index 052b971b3f..895caf5598 100644 --- a/src/lib/evas/canvas/efl_input_key.c +++ b/src/lib/evas/canvas/efl_input_key.c @@ -193,7 +193,8 @@ _efl_input_key_efl_input_event_dup(Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd) Efl_Input_Key_Data *ev; Efl_Input_Key *evt; - evt = efl_add(MY_CLASS, NULL); + evt = efl_add(MY_CLASS, efl_parent_get(obj), + efl_allow_parent_unref_set(efl_added, EINA_TRUE)); ev = efl_data_scope_get(evt, MY_CLASS); if (!ev) return NULL; diff --git a/src/lib/evas/canvas/efl_input_pointer.c b/src/lib/evas/canvas/efl_input_pointer.c index ec5834183b..252f5934a1 100644 --- a/src/lib/evas/canvas/efl_input_pointer.c +++ b/src/lib/evas/canvas/efl_input_pointer.c @@ -148,7 +148,8 @@ _efl_input_pointer_efl_input_event_dup(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Da Efl_Input_Pointer_Data *ev; Efl_Input_Focus *evt; - evt = efl_add(MY_CLASS, NULL); + evt = efl_add(MY_CLASS, efl_parent_get(obj), + efl_allow_parent_unref_set(efl_added, EINA_TRUE)); ev = efl_data_scope_get(evt, MY_CLASS); if (!ev) return NULL;