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 d3436af616
See 6bed255fc4
See 96d94e0076 <-- main commit
This commit is contained in:
Jean-Philippe Andre 2017-09-28 16:45:45 +09:00
parent d3436af616
commit f7a7a29cc0
4 changed files with 8 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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