aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2018-02-05 20:10:18 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2018-02-06 17:54:27 +0900
commit6e743106564ac11c390b6d76bf48f3dad9e72005 (patch)
tree6e1c8d96ec470fb327820a7b477743973acc9bd0
parenteo: Introduce efl_invalidate (diff)
downloadefl-devs/jpeg/efl_invalidate.tar.gz
-rw-r--r--src/examples/elementary/calendar_cxx_example_02.cc8
-rw-r--r--src/lib/ecore/ecore.c2
-rw-r--r--src/lib/edje/edje_main.c9
-rw-r--r--src/lib/edje/edje_part_helper.h3
-rw-r--r--src/lib/elementary/efl_ui_win.c9
-rw-r--r--src/lib/elementary/elm_config.c2
-rw-r--r--src/lib/elementary/elm_part_helper.h3
-rw-r--r--src/lib/elementary/elm_sys_notify.c2
-rw-r--r--src/lib/eo/efl_object.eo19
-rw-r--r--src/lib/eo/eo.c16
-rw-r--r--src/lib/eo/eo_base_class.c31
-rw-r--r--src/lib/eo/eo_private.h59
-rw-r--r--src/lib/evas/canvas/efl_input_focus.c3
-rw-r--r--src/lib/evas/canvas/efl_input_hold.c3
-rw-r--r--src/lib/evas/canvas/efl_input_key.c3
-rw-r--r--src/lib/evas/canvas/efl_input_pointer.c3
-rw-r--r--src/lib/evas/canvas/evas_main.c5
-rw-r--r--src/tests/eo/suite/eo_test_general.c1
18 files changed, 79 insertions, 102 deletions
diff --git a/src/examples/elementary/calendar_cxx_example_02.cc b/src/examples/elementary/calendar_cxx_example_02.cc
index 047f5841f8..f22d22bfc0 100644
--- a/src/examples/elementary/calendar_cxx_example_02.cc
+++ b/src/examples/elementary/calendar_cxx_example_02.cc
@@ -18,7 +18,7 @@ struct appData
add(m_win);
m_win.text_set("Calendar Layout Formatting Example");
- m_win.delete_request_event_cb_add([&](){ destroy(); });
+ m_win.delete_request_event_cb_add([&](){ m_win._delete(); });
efl::ui::Calendar cal(add, m_win);
m_win.content_set(cal);
@@ -39,12 +39,6 @@ struct appData
cal.format_cb_set(cb_a);
}
- void destroy() {
- // FIXME: need del() function and no error on unref().
- ::efl_allow_parent_unref_set(m_win, true);
- m_win = nullptr;
- }
-
private:
efl::ui::Win m_win;
};
diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index a2779bed86..c1cd2e68fa 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -276,7 +276,7 @@ ecore_init(void)
_ecore_main_loop_init();
if (!_ecore_event_init()) goto shutdown_event;
- vpath = efl_add(EFL_VPATH_CORE_CLASS, NULL);
+ vpath = efl_add(EFL_VPATH_CORE_CLASS, efl_main_loop_get());
if (vpath) efl_vpath_manager_register(EFL_VPATH_MANAGER_CLASS, 0, vpath);
_ecore_signal_init();
diff --git a/src/lib/edje/edje_main.c b/src/lib/edje/edje_main.c
index 551b4f2e6e..8f90a26e0a 100644
--- a/src/lib/edje/edje_main.c
+++ b/src/lib/edje/edje_main.c
@@ -83,7 +83,7 @@ edje_init(void)
}
_edje_scale = FROM_DOUBLE(1.0);
- _edje_global_obj = efl_add(EDJE_GLOBAL_CLASS, NULL);
+ _edje_global_obj = efl_add(EDJE_GLOBAL_CLASS, efl_main_loop_get());
if (!_edje_global_obj ||
!efl_loop_register(efl_main_loop_get(), EFL_GFX_COLOR_CLASS_INTERFACE, _edje_global_obj) ||
!efl_loop_register(efl_main_loop_get(), EFL_GFX_TEXT_CLASS_INTERFACE, _edje_global_obj) ||
@@ -273,12 +273,13 @@ edje_shutdown(void)
void
_edje_class_init(void)
{
+ Eo *loop = efl_loop_main_get(EFL_LOOP_CLASS);
if (!_edje_color_class_member)
- _edje_color_class_member = efl_add(EFL_OBSERVABLE_CLASS, NULL);
+ _edje_color_class_member = efl_add(EFL_OBSERVABLE_CLASS, loop);
if (!_edje_text_class_member)
- _edje_text_class_member = efl_add(EFL_OBSERVABLE_CLASS, NULL);
+ _edje_text_class_member = efl_add(EFL_OBSERVABLE_CLASS, loop);
if (!_edje_size_class_member)
- _edje_size_class_member = efl_add(EFL_OBSERVABLE_CLASS, NULL);
+ _edje_size_class_member = efl_add(EFL_OBSERVABLE_CLASS, loop);
}
void
diff --git a/src/lib/edje/edje_part_helper.h b/src/lib/edje/edje_part_helper.h
index 0af166aef7..53fb4d12fa 100644
--- a/src/lib/edje/edje_part_helper.h
+++ b/src/lib/edje/edje_part_helper.h
@@ -52,7 +52,7 @@ _part_proxy_del_cb(Eo *proxy, Eo **static_var)
do { if (PROXY_STATIC_VAR(type)) \
{ \
efl_del_intercept_set(PROXY_STATIC_VAR(type), NULL); \
- efl_del(PROXY_STATIC_VAR(type)); \
+ efl_unref(PROXY_STATIC_VAR(type)); \
PROXY_STATIC_VAR(type) = NULL; \
} } while (0)
@@ -97,7 +97,6 @@ _edje_ ## type ## _internal_proxy_get(Edje_Object *obj EINA_UNUSED, Edje *ed, Ed
} \
__VA_ARGS__; \
if (!no_del_cb) efl_del_intercept_set(proxy, _ ## type ## _del_cb); \
- efl_allow_parent_unref_set(proxy, 1); \
___efl_auto_unref_set(proxy, 1); \
return proxy; \
}
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index ebc7d8979b..4d02a62361 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -5509,10 +5509,6 @@ _efl_ui_win_efl_object_constructor(Eo *obj, Efl_Ui_Win_Data *pd)
pd->provider = efl_add(EFL_UI_FOCUS_PARENT_PROVIDER_STANDARD_CLASS, obj);
pd->profile.available = eina_array_new(4);
- // For bindings: if no parent, allow simple unref
- if (!efl_parent_get(obj))
- efl_allow_parent_unref_set(obj, EINA_TRUE);
-
efl_composite_attach(obj, pd->manager);
_efl_ui_focus_manager_redirect_events_add(pd->manager, obj);
@@ -8251,7 +8247,8 @@ elm_win_window_id_get(const Evas_Object *obj)
if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME_LEGACY))
{
Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
- return ecore_evas_window_get(ee);
+ if (ee) return ecore_evas_window_get(ee);
+ else return 0;
}
sd = efl_data_scope_safe_get(obj, MY_CLASS);
@@ -8646,7 +8643,7 @@ elm_win_add(Evas_Object *parent, const char *name, Efl_Ui_Win_Type type)
default: break;
}
- return elm_legacy_add(klass, parent,
+ return elm_legacy_add(klass, parent ? parent : efl_main_loop_get(),
efl_ui_win_name_set(efl_added, name),
efl_ui_win_type_set(efl_added, type));
}
diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c
index ac1fae0262..bcef813b6e 100644
--- a/src/lib/elementary/elm_config.c
+++ b/src/lib/elementary/elm_config.c
@@ -1660,7 +1660,7 @@ _efl_config_obj_del(Eo *obj EINA_UNUSED)
static void
_config_load(void)
{
- _efl_config_obj = efl_add(EFL_CONFIG_GLOBAL_CLASS, NULL);
+ _efl_config_obj = efl_add(EFL_CONFIG_GLOBAL_CLASS, efl_main_loop_get());
efl_loop_register(efl_main_loop_get(), EFL_CONFIG_INTERFACE, _efl_config_obj);
efl_loop_register(efl_main_loop_get(), EFL_CONFIG_GLOBAL_CLASS, _efl_config_obj);
efl_del_intercept_set(_efl_config_obj, _efl_config_obj_del);
diff --git a/src/lib/elementary/elm_part_helper.h b/src/lib/elementary/elm_part_helper.h
index 29b08a68d6..652fd8405f 100644
--- a/src/lib/elementary/elm_part_helper.h
+++ b/src/lib/elementary/elm_part_helper.h
@@ -57,7 +57,6 @@ _elm_part_initialize(Eo *proxy, Eo *obj, const char *part)
Elm_Part_Data *pd = efl_data_scope_get(proxy, EFL_UI_WIDGET_PART_CLASS);
EINA_SAFETY_ON_FALSE_RETURN_VAL(pd && obj && part, NULL);
- efl_allow_parent_unref_set(proxy, 1);
___efl_auto_unref_set(proxy, 1);
pd->part = eina_tmpstr_add(part);
pd->obj = obj;
@@ -68,7 +67,7 @@ _elm_part_initialize(Eo *proxy, Eo *obj, const char *part)
static inline Eo *
ELM_PART_IMPLEMENT(const Efl_Class *part_klass, const Eo *obj, const char *part)
{
- return efl_add(part_klass, NULL,
+ return efl_add(part_klass, (Eo *) obj,
_elm_part_initialize(efl_added, (Eo *) obj, part));
}
diff --git a/src/lib/elementary/elm_sys_notify.c b/src/lib/elementary/elm_sys_notify.c
index 4d1db56af8..f0aaf7a55e 100644
--- a/src/lib/elementary/elm_sys_notify.c
+++ b/src/lib/elementary/elm_sys_notify.c
@@ -203,7 +203,7 @@ _elm_sys_notify_singleton_get(Eo *obj EINA_UNUSED,
void *sd EINA_UNUSED)
{
if (!_singleton)
- _singleton = efl_add(MY_CLASS, NULL);
+ _singleton = efl_add(MY_CLASS, efl_loop_main_get(EFL_LOOP_CLASS));
return _singleton;
}
diff --git a/src/lib/eo/efl_object.eo b/src/lib/eo/efl_object.eo
index d069d4e591..f3c0e96959 100644
--- a/src/lib/eo/efl_object.eo
+++ b/src/lib/eo/efl_object.eo
@@ -301,25 +301,6 @@ abstract Efl.Object ()
]]
return: bool; [[$true if it is. $false otherwise.]]
}
- @property allow_parent_unref {
- [[Allow an object to be deleted by unref even if it has a parent.
-
- This simply hides the error message warning that an object being
- destroyed still has a parent. This property is false by default.
-
- In a normal object use case, when ownership of an object is given
- to a caller, said ownership should be released with efl_unref().
- If the object has a parent, this will print error messages, as
- $efl_unref() is stealing the ref from the parent.
-
- Warning: Use this function very carefully, unless you're absolutely
- sure of what you are doing.
- ]]
- values {
- allow: bool(false); [[Whether to allow $efl_unref() to zero
- even if @.parent is not $null.]]
- }
- }
}
implements {
class.constructor;
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 57adcb1a84..d4a67729f8 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -868,10 +868,14 @@ _efl_add_internal_start(const char *file, int line, const Efl_Class *klass_id, E
EO_CLASS_POINTER_GOTO_PROXY(klass_id, klass, err_klass);
- if (parent_id)
+ if (EINA_LIKELY(parent_id != NULL))
{
EO_OBJ_POINTER_GOTO_PROXY(parent_id, parent, err_parent);
}
+ else
+ {
+ ERR("Object of class %s created without a parent!", klass->desc->name);
+ }
// not likely so use goto to alleviate l1 instruction cache of rare code
if (EINA_UNLIKELY(klass->desc->type != EFL_CLASS_TYPE_REGULAR))
@@ -1918,6 +1922,16 @@ err:
EO_OBJ_DONE(obj_id);
}
+EAPI void
+___efl_auto_unref_set(Eo *obj_id, Eina_Bool enable)
+{
+ // Write-only property
+ EO_OBJ_POINTER(obj_id, obj);
+ obj->auto_unref = enable ? 1 : 0;
+ if (enable)
+ obj->was_auto_unref = EINA_TRUE;
+}
+
EAPI int
___efl_ref2_count(const Eo *obj_id)
{
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 234afbcd82..fd112a12a9 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -59,7 +59,6 @@ typedef struct
Eina_Bool callback_stopped : 1;
Eina_Bool need_cleaning : 1;
Eina_Bool parent_sunk : 1; // If parent ref has already been settled (parent has been set, or we are in add_ref mode
- Eina_Bool allow_parent_unref : 1; // Allows unref to zero even with a parent
Eina_Bool has_destruct_event_cb : 1; // No proper count: minor optimization triggered at destruction only
} Efl_Object_Data;
@@ -603,7 +602,8 @@ _efl_object_del(const Eo *obj, Efl_Object_Data *pd EINA_UNUSED)
}
else
{
- efl_unref(obj);
+ ERR("efl_del called on an object without a parent!");
+ //efl_unref(obj);
}
}
@@ -2066,7 +2066,7 @@ _efl_object_destructor(Eo *obj, Efl_Object_Data *pd)
while (pd->children)
{
child = _eo_obj_id_get(EINA_INLIST_CONTAINER_GET(pd->children, _Eo_Object));
- efl_parent_set(child, NULL);
+ efl_del(child);
}
}
@@ -2089,8 +2089,9 @@ _efl_object_destructor(Eo *obj, Efl_Object_Data *pd)
if (EINA_UNLIKELY(pd->parent != NULL))
{
- if (EINA_LIKELY(!pd->allow_parent_unref))
- ERR("Object '%p' still has a parent at the time of destruction.", obj);
+ EO_OBJ_POINTER(obj, obj_data);
+ ERR("Object '%s@%p' still has a parent at the time of destruction.",
+ obj_data->klass->desc->name, obj);
efl_parent_set(obj, NULL);
}
@@ -2122,26 +2123,6 @@ _efl_object_destructor(Eo *obj, Efl_Object_Data *pd)
_eo_condtor_done(obj);
}
-EOLIAN static void
-_efl_object_allow_parent_unref_set(Eo *obj_id EINA_UNUSED, Efl_Object_Data *pd, Eina_Bool allow)
-{
- pd->allow_parent_unref = !!allow;
-}
-
-EOLIAN static Eina_Bool
-_efl_object_allow_parent_unref_get(Eo *obj_id EINA_UNUSED, Efl_Object_Data *pd)
-{
- return pd->allow_parent_unref;
-}
-
-EAPI void
-___efl_auto_unref_set(Eo *obj_id, Eina_Bool enable)
-{
- // Write-only property
- EO_OBJ_POINTER(obj_id, obj);
- obj->auto_unref = enable ? 1 : 0;
-}
-
EOLIAN static Eo *
_efl_object_finalize(Eo *obj, Efl_Object_Data *pd EINA_UNUSED)
{
diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h
index 74e19f2ca8..008b1881f8 100644
--- a/src/lib/eo/eo_private.h
+++ b/src/lib/eo/eo_private.h
@@ -121,7 +121,8 @@ struct _Eo_Object
Eina_Bool del_triggered:1;
Eina_Bool destructed:1;
Eina_Bool manual_free:1;
- unsigned char auto_unref : 1; // unref after 1 call - hack for parts
+ Eina_Bool auto_unref:1; // unref after 1 call - hack for parts
+ Eina_Bool was_auto_unref:1; // object has been marked as auto-unref
};
/* How we search and store the implementations in classes. */
@@ -264,8 +265,9 @@ _efl_del_internal(_Eo_Object *obj, const char *func_name, const char *file, int
if (!obj->condtor_done)
{
- ERR("in %s:%d: func '%s' Object of class '%s' - Not all of the object destructors have been executed.",
- file, line, func_name, klass->desc->name);
+ eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
+ "Object of class '%s' - Not all of the object "
+ "destructors have been executed.", klass->desc->name);
}
/*FIXME: add eo_class_unref(klass) ? - just to clear the caches. */
@@ -308,8 +310,8 @@ _efl_invalidate_internal(_Eo_Object *obj, const char *func_name, const char *fil
if (EINA_UNLIKELY(obj->invalidated))
{
- ERR("in %s:%d: func '%s' Object %p already invalidated.",
- file, line, func_name, obj_id);
+ eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
+ "Object %p already invalidated.", obj_id);
_eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
__FUNCTION__, __FILE__, __LINE__);
return;
@@ -317,9 +319,9 @@ _efl_invalidate_internal(_Eo_Object *obj, const char *func_name, const char *fil
if (EINA_UNLIKELY(obj->invalidate_triggered))
{
- ERR("in %s:%d: func '%s' Object %p invalidate already triggered. "
- "You wrongly call efl_invalidate() within an invalidator.",
- file, line, func_name, obj_id);
+ eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
+ "Object %p invalidate already triggered. You wrongly "
+ "called efl_invalidate() within an invalidator.", obj_id);
_eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
__FUNCTION__, __FILE__, __LINE__);
return;
@@ -334,9 +336,10 @@ _efl_invalidate_internal(_Eo_Object *obj, const char *func_name, const char *fil
if (EINA_UNLIKELY(!obj->condtor_done))
{
- ERR("in %s:%d: func '%s' Object %p of class '%s' - Not all of the "
- "object invalidators have been executed.",
- file, line, func_name, obj_id, obj->klass->desc->name);
+ eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
+ "Object %p of class '%s' - Not all of the "
+ "object invalidators have been executed.",
+ obj_id, obj->klass->desc->name);
obj->condtor_done = EINA_FALSE;
}
@@ -357,8 +360,9 @@ _efl_unref_internal(_Eo_Object *obj, const char *func_name, const char *file, in
obj_id = _eo_obj_id_get(obj);
if (obj->refcount < 0)
{
- ERR("in %s:%d: func '%s' Obj:%p. Refcount (%d) < 0. Too many unrefs.",
- file, line, func_name, obj, obj->refcount);
+ eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
+ "Object %p reached refcount (%d) < 0. Too many unrefs.",
+ obj, obj->refcount);
_eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
__FUNCTION__, __FILE__, __LINE__);
return;
@@ -366,13 +370,21 @@ _efl_unref_internal(_Eo_Object *obj, const char *func_name, const char *file, in
if (!obj->invalidated)
{
+ if (!obj->was_auto_unref)
+ {
+ eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
+ "Object %s@%p unref'ed but not yet invalidated.",
+ obj->klass->desc->name, obj_id);
+ _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
+ __FUNCTION__, __FILE__, __LINE__);
+ }
_efl_invalidate_internal(obj, func_name, file, line);
}
if (obj->destructed)
{
- ERR("in %s:%d: func '%s' Object %p already destructed.",
- file, line, func_name, obj_id);
+ eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
+ "Object %p already destructed.", obj_id);
_eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
__FUNCTION__, __FILE__, __LINE__);
return;
@@ -380,9 +392,10 @@ _efl_unref_internal(_Eo_Object *obj, const char *func_name, const char *file, in
if (obj->del_triggered)
{
- ERR("in %s:%d: func '%s' Object %p deletion already triggered. "
- "You wrongly call efl_unref() within a destructor.",
- file, line, func_name, obj_id);
+ eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
+ "Object %p deletion already triggered. "
+ "You wrongly call efl_unref() within a destructor.",
+ obj_id);
_eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
__FUNCTION__, __FILE__, __LINE__);
return;
@@ -416,13 +429,15 @@ _efl_unref_internal(_Eo_Object *obj, const char *func_name, const char *file, in
Eo_Xref_Node *xref = EINA_INLIST_CONTAINER_GET(obj->data_xrefs, Eo_Xref_Node);
if (obj_id == xref->ref_obj)
{
- WRN("in %s:%d: func '%s' Object %p still has a reference to its own data (subclass: %s). Origin: %s:%d",
- file, line, func_name, obj_id, xref->data_klass, xref->file, xref->line);
+ eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_WARN, file, func_name, line,
+ "Object %p still has a reference to its own data (subclass: %s). Origin: %s:%d",
+ obj_id, xref->data_klass, xref->file, xref->line);
}
else
{
- ERR("in %s:%d: func '%s' Data of object %p (subclass: %s) is still referenced by object %p. Origin: %s:%d",
- file, line, func_name, obj_id, xref->data_klass, xref->ref_obj, xref->file, xref->line);
+ eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
+ "Data of object %p (subclass: %s) is still referenced by object %p. Origin: %s:%d",
+ obj_id, xref->data_klass, xref->ref_obj, xref->file, xref->line);
}
eina_freeq_ptr_main_add(xref, free, sizeof(*xref));
diff --git a/src/lib/evas/canvas/efl_input_focus.c b/src/lib/evas/canvas/efl_input_focus.c
index fc7e737892..fd076a06b3 100644
--- a/src/lib/evas/canvas/efl_input_focus.c
+++ b/src/lib/evas/canvas/efl_input_focus.c
@@ -121,8 +121,7 @@ _efl_input_focus_efl_duplicate_duplicate(const Eo *obj, Efl_Input_Focus_Data *pd
Efl_Input_Focus_Data *ev;
Efl_Input_Focus *evt;
- evt = efl_add(MY_CLASS, efl_parent_get(obj),
- efl_allow_parent_unref_set(efl_added, EINA_TRUE));
+ evt = efl_add(MY_CLASS, efl_parent_get(obj));
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 0e23efd3cc..e9f3bd02e1 100644
--- a/src/lib/evas/canvas/efl_input_hold.c
+++ b/src/lib/evas/canvas/efl_input_hold.c
@@ -106,8 +106,7 @@ _efl_input_hold_efl_duplicate_duplicate(const Eo *obj, Efl_Input_Hold_Data *pd)
Efl_Input_Hold_Data *ev;
Efl_Input_Hold *evt;
- evt = efl_add(MY_CLASS, efl_parent_get(obj),
- efl_allow_parent_unref_set(efl_added, EINA_TRUE));
+ evt = efl_add(MY_CLASS, efl_parent_get(obj));
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 e9bdcfd01c..53f423495f 100644
--- a/src/lib/evas/canvas/efl_input_key.c
+++ b/src/lib/evas/canvas/efl_input_key.c
@@ -197,8 +197,7 @@ _efl_input_key_efl_duplicate_duplicate(const Eo *obj, Efl_Input_Key_Data *pd)
Efl_Input_Key_Data *ev;
Efl_Input_Key *evt;
- evt = efl_add(MY_CLASS, efl_parent_get(obj),
- efl_allow_parent_unref_set(efl_added, EINA_TRUE));
+ evt = efl_add(MY_CLASS, efl_parent_get(obj));
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 a11739abdb..d7ec8b58be 100644
--- a/src/lib/evas/canvas/efl_input_pointer.c
+++ b/src/lib/evas/canvas/efl_input_pointer.c
@@ -152,8 +152,7 @@ _efl_input_pointer_efl_duplicate_duplicate(const Eo *obj, Efl_Input_Pointer_Data
Efl_Input_Pointer_Data *ev;
Efl_Input_Focus *evt;
- evt = efl_add(MY_CLASS, efl_parent_get(obj),
- efl_allow_parent_unref_set(efl_added, EINA_TRUE));
+ evt = efl_add(MY_CLASS, efl_parent_get(obj));
ev = efl_data_scope_get(evt, MY_CLASS);
if (!ev) return NULL;
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 7498916611..33e680b2ff 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -198,7 +198,7 @@ evas_shutdown(void)
EAPI Evas *
evas_new(void)
{
- Evas_Object *eo_obj = efl_add(EVAS_CANVAS_CLASS, NULL);
+ Evas_Object *eo_obj = efl_add(EVAS_CANVAS_CLASS, efl_loop_main_get(EFL_LOOP_CLASS));
return eo_obj;
}
@@ -211,6 +211,7 @@ _evas_key_mask_free(void *data)
EOLIAN static Eo *
_evas_canvas_efl_object_constructor(Eo *eo_obj, Evas_Public_Data *e)
{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(efl_parent_get(eo_obj), NULL);
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
e->evas = eo_obj;
@@ -274,7 +275,7 @@ evas_free(Evas *eo_e)
return;
MAGIC_CHECK_END();
evas_sync(eo_e);
- efl_unref(eo_e);
+ efl_del(eo_e);
}
EOLIAN static void
diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c
index e475889e95..510b3d5cdb 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -1797,7 +1797,6 @@ START_TEST(efl_object_auto_unref_test)
parent = efl_add(SIMPLE_CLASS, NULL);
obj = efl_add(SIMPLE_CLASS, parent);
fail_if(efl_ref_count(obj) != 1);
- efl_allow_parent_unref_set(obj, 1);
efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del);
___efl_auto_unref_set(obj, 1);
fail_if(_auto_unref_del);