summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
18 18
19 add(m_win); 19 add(m_win);
20 m_win.text_set("Calendar Layout Formatting Example"); 20 m_win.text_set("Calendar Layout Formatting Example");
21 m_win.delete_request_event_cb_add([&](){ destroy(); }); 21 m_win.delete_request_event_cb_add([&](){ m_win._delete(); });
22 22
23 efl::ui::Calendar cal(add, m_win); 23 efl::ui::Calendar cal(add, m_win);
24 m_win.content_set(cal); 24 m_win.content_set(cal);
@@ -39,12 +39,6 @@ struct appData
39 cal.format_cb_set(cb_a); 39 cal.format_cb_set(cb_a);
40 } 40 }
41 41
42 void destroy() {
43 // FIXME: need del() function and no error on unref().
44 ::efl_allow_parent_unref_set(m_win, true);
45 m_win = nullptr;
46 }
47
48private: 42private:
49 efl::ui::Win m_win; 43 efl::ui::Win m_win;
50}; 44};
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)
276 _ecore_main_loop_init(); 276 _ecore_main_loop_init();
277 if (!_ecore_event_init()) goto shutdown_event; 277 if (!_ecore_event_init()) goto shutdown_event;
278 278
279 vpath = efl_add(EFL_VPATH_CORE_CLASS, NULL); 279 vpath = efl_add(EFL_VPATH_CORE_CLASS, efl_main_loop_get());
280 if (vpath) efl_vpath_manager_register(EFL_VPATH_MANAGER_CLASS, 0, vpath); 280 if (vpath) efl_vpath_manager_register(EFL_VPATH_MANAGER_CLASS, 0, vpath);
281 281
282 _ecore_signal_init(); 282 _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)
83 } 83 }
84 84
85 _edje_scale = FROM_DOUBLE(1.0); 85 _edje_scale = FROM_DOUBLE(1.0);
86 _edje_global_obj = efl_add(EDJE_GLOBAL_CLASS, NULL); 86 _edje_global_obj = efl_add(EDJE_GLOBAL_CLASS, efl_main_loop_get());
87 if (!_edje_global_obj || 87 if (!_edje_global_obj ||
88 !efl_loop_register(efl_main_loop_get(), EFL_GFX_COLOR_CLASS_INTERFACE, _edje_global_obj) || 88 !efl_loop_register(efl_main_loop_get(), EFL_GFX_COLOR_CLASS_INTERFACE, _edje_global_obj) ||
89 !efl_loop_register(efl_main_loop_get(), EFL_GFX_TEXT_CLASS_INTERFACE, _edje_global_obj) || 89 !efl_loop_register(efl_main_loop_get(), EFL_GFX_TEXT_CLASS_INTERFACE, _edje_global_obj) ||
@@ -273,12 +273,13 @@ edje_shutdown(void)
273void 273void
274_edje_class_init(void) 274_edje_class_init(void)
275{ 275{
276 Eo *loop = efl_loop_main_get(EFL_LOOP_CLASS);
276 if (!_edje_color_class_member) 277 if (!_edje_color_class_member)
277 _edje_color_class_member = efl_add(EFL_OBSERVABLE_CLASS, NULL); 278 _edje_color_class_member = efl_add(EFL_OBSERVABLE_CLASS, loop);
278 if (!_edje_text_class_member) 279 if (!_edje_text_class_member)
279 _edje_text_class_member = efl_add(EFL_OBSERVABLE_CLASS, NULL); 280 _edje_text_class_member = efl_add(EFL_OBSERVABLE_CLASS, loop);
280 if (!_edje_size_class_member) 281 if (!_edje_size_class_member)
281 _edje_size_class_member = efl_add(EFL_OBSERVABLE_CLASS, NULL); 282 _edje_size_class_member = efl_add(EFL_OBSERVABLE_CLASS, loop);
282} 283}
283 284
284void 285void
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)
52 do { if (PROXY_STATIC_VAR(type)) \ 52 do { if (PROXY_STATIC_VAR(type)) \
53 { \ 53 { \
54 efl_del_intercept_set(PROXY_STATIC_VAR(type), NULL); \ 54 efl_del_intercept_set(PROXY_STATIC_VAR(type), NULL); \
55 efl_del(PROXY_STATIC_VAR(type)); \ 55 efl_unref(PROXY_STATIC_VAR(type)); \
56 PROXY_STATIC_VAR(type) = NULL; \ 56 PROXY_STATIC_VAR(type) = NULL; \
57 } } while (0) 57 } } while (0)
58 58
@@ -97,7 +97,6 @@ _edje_ ## type ## _internal_proxy_get(Edje_Object *obj EINA_UNUSED, Edje *ed, Ed
97 } \ 97 } \
98 __VA_ARGS__; \ 98 __VA_ARGS__; \
99 if (!no_del_cb) efl_del_intercept_set(proxy, _ ## type ## _del_cb); \ 99 if (!no_del_cb) efl_del_intercept_set(proxy, _ ## type ## _del_cb); \
100 efl_allow_parent_unref_set(proxy, 1); \
101 ___efl_auto_unref_set(proxy, 1); \ 100 ___efl_auto_unref_set(proxy, 1); \
102 return proxy; \ 101 return proxy; \
103} 102}
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)
5509 pd->provider = efl_add(EFL_UI_FOCUS_PARENT_PROVIDER_STANDARD_CLASS, obj); 5509 pd->provider = efl_add(EFL_UI_FOCUS_PARENT_PROVIDER_STANDARD_CLASS, obj);
5510 pd->profile.available = eina_array_new(4); 5510 pd->profile.available = eina_array_new(4);
5511 5511
5512 // For bindings: if no parent, allow simple unref
5513 if (!efl_parent_get(obj))
5514 efl_allow_parent_unref_set(obj, EINA_TRUE);
5515
5516 efl_composite_attach(obj, pd->manager); 5512 efl_composite_attach(obj, pd->manager);
5517 _efl_ui_focus_manager_redirect_events_add(pd->manager, obj); 5513 _efl_ui_focus_manager_redirect_events_add(pd->manager, obj);
5518 5514
@@ -8251,7 +8247,8 @@ elm_win_window_id_get(const Evas_Object *obj)
8251 if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME_LEGACY)) 8247 if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME_LEGACY))
8252 { 8248 {
8253 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); 8249 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
8254 return ecore_evas_window_get(ee); 8250 if (ee) return ecore_evas_window_get(ee);
8251 else return 0;
8255 } 8252 }
8256 8253
8257 sd = efl_data_scope_safe_get(obj, MY_CLASS); 8254 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)
8646 default: break; 8643 default: break;
8647 } 8644 }
8648 8645
8649 return elm_legacy_add(klass, parent, 8646 return elm_legacy_add(klass, parent ? parent : efl_main_loop_get(),
8650 efl_ui_win_name_set(efl_added, name), 8647 efl_ui_win_name_set(efl_added, name),
8651 efl_ui_win_type_set(efl_added, type)); 8648 efl_ui_win_type_set(efl_added, type));
8652} 8649}
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)
1660static void 1660static void
1661_config_load(void) 1661_config_load(void)
1662{ 1662{
1663 _efl_config_obj = efl_add(EFL_CONFIG_GLOBAL_CLASS, NULL); 1663 _efl_config_obj = efl_add(EFL_CONFIG_GLOBAL_CLASS, efl_main_loop_get());
1664 efl_loop_register(efl_main_loop_get(), EFL_CONFIG_INTERFACE, _efl_config_obj); 1664 efl_loop_register(efl_main_loop_get(), EFL_CONFIG_INTERFACE, _efl_config_obj);
1665 efl_loop_register(efl_main_loop_get(), EFL_CONFIG_GLOBAL_CLASS, _efl_config_obj); 1665 efl_loop_register(efl_main_loop_get(), EFL_CONFIG_GLOBAL_CLASS, _efl_config_obj);
1666 efl_del_intercept_set(_efl_config_obj, _efl_config_obj_del); 1666 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)
57 Elm_Part_Data *pd = efl_data_scope_get(proxy, EFL_UI_WIDGET_PART_CLASS); 57 Elm_Part_Data *pd = efl_data_scope_get(proxy, EFL_UI_WIDGET_PART_CLASS);
58 58
59 EINA_SAFETY_ON_FALSE_RETURN_VAL(pd && obj && part, NULL); 59 EINA_SAFETY_ON_FALSE_RETURN_VAL(pd && obj && part, NULL);
60 efl_allow_parent_unref_set(proxy, 1);
61 ___efl_auto_unref_set(proxy, 1); 60 ___efl_auto_unref_set(proxy, 1);
62 pd->part = eina_tmpstr_add(part); 61 pd->part = eina_tmpstr_add(part);
63 pd->obj = obj; 62 pd->obj = obj;
@@ -68,7 +67,7 @@ _elm_part_initialize(Eo *proxy, Eo *obj, const char *part)
68static inline Eo * 67static inline Eo *
69ELM_PART_IMPLEMENT(const Efl_Class *part_klass, const Eo *obj, const char *part) 68ELM_PART_IMPLEMENT(const Efl_Class *part_klass, const Eo *obj, const char *part)
70{ 69{
71 return efl_add(part_klass, NULL, 70 return efl_add(part_klass, (Eo *) obj,
72 _elm_part_initialize(efl_added, (Eo *) obj, part)); 71 _elm_part_initialize(efl_added, (Eo *) obj, part));
73} 72}
74 73
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,
203 void *sd EINA_UNUSED) 203 void *sd EINA_UNUSED)
204{ 204{
205 if (!_singleton) 205 if (!_singleton)
206 _singleton = efl_add(MY_CLASS, NULL); 206 _singleton = efl_add(MY_CLASS, efl_loop_main_get(EFL_LOOP_CLASS));
207 return _singleton; 207 return _singleton;
208} 208}
209 209
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 ()
301 ]] 301 ]]
302 return: bool; [[$true if it is. $false otherwise.]] 302 return: bool; [[$true if it is. $false otherwise.]]
303 } 303 }
304 @property allow_parent_unref {
305 [[Allow an object to be deleted by unref even if it has a parent.
306
307 This simply hides the error message warning that an object being
308 destroyed still has a parent. This property is false by default.
309
310 In a normal object use case, when ownership of an object is given
311 to a caller, said ownership should be released with efl_unref().
312 If the object has a parent, this will print error messages, as
313 $efl_unref() is stealing the ref from the parent.
314
315 Warning: Use this function very carefully, unless you're absolutely
316 sure of what you are doing.
317 ]]
318 values {
319 allow: bool(false); [[Whether to allow $efl_unref() to zero
320 even if @.parent is not $null.]]
321 }
322 }
323 } 304 }
324 implements { 305 implements {
325 class.constructor; 306 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
868 868
869 EO_CLASS_POINTER_GOTO_PROXY(klass_id, klass, err_klass); 869 EO_CLASS_POINTER_GOTO_PROXY(klass_id, klass, err_klass);
870 870
871 if (parent_id) 871 if (EINA_LIKELY(parent_id != NULL))
872 { 872 {
873 EO_OBJ_POINTER_GOTO_PROXY(parent_id, parent, err_parent); 873 EO_OBJ_POINTER_GOTO_PROXY(parent_id, parent, err_parent);
874 } 874 }
875 else
876 {
877 ERR("Object of class %s created without a parent!", klass->desc->name);
878 }
875 879
876 // not likely so use goto to alleviate l1 instruction cache of rare code 880 // not likely so use goto to alleviate l1 instruction cache of rare code
877 if (EINA_UNLIKELY(klass->desc->type != EFL_CLASS_TYPE_REGULAR)) 881 if (EINA_UNLIKELY(klass->desc->type != EFL_CLASS_TYPE_REGULAR))
@@ -1918,6 +1922,16 @@ err:
1918 EO_OBJ_DONE(obj_id); 1922 EO_OBJ_DONE(obj_id);
1919} 1923}
1920 1924
1925EAPI void
1926___efl_auto_unref_set(Eo *obj_id, Eina_Bool enable)
1927{
1928 // Write-only property
1929 EO_OBJ_POINTER(obj_id, obj);
1930 obj->auto_unref = enable ? 1 : 0;
1931 if (enable)
1932 obj->was_auto_unref = EINA_TRUE;
1933}
1934
1921EAPI int 1935EAPI int
1922___efl_ref2_count(const Eo *obj_id) 1936___efl_ref2_count(const Eo *obj_id)
1923{ 1937{
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
59 Eina_Bool callback_stopped : 1; 59 Eina_Bool callback_stopped : 1;
60 Eina_Bool need_cleaning : 1; 60 Eina_Bool need_cleaning : 1;
61 Eina_Bool parent_sunk : 1; // If parent ref has already been settled (parent has been set, or we are in add_ref mode 61 Eina_Bool parent_sunk : 1; // If parent ref has already been settled (parent has been set, or we are in add_ref mode
62 Eina_Bool allow_parent_unref : 1; // Allows unref to zero even with a parent
63 Eina_Bool has_destruct_event_cb : 1; // No proper count: minor optimization triggered at destruction only 62 Eina_Bool has_destruct_event_cb : 1; // No proper count: minor optimization triggered at destruction only
64} Efl_Object_Data; 63} Efl_Object_Data;
65 64
@@ -603,7 +602,8 @@ _efl_object_del(const Eo *obj, Efl_Object_Data *pd EINA_UNUSED)
603 } 602 }
604 else 603 else
605 { 604 {
606 efl_unref(obj); 605 ERR("efl_del called on an object without a parent!");
606 //efl_unref(obj);
607 } 607 }
608} 608}
609 609
@@ -2066,7 +2066,7 @@ _efl_object_destructor(Eo *obj, Efl_Object_Data *pd)
2066 while (pd->children) 2066 while (pd->children)
2067 { 2067 {
2068 child = _eo_obj_id_get(EINA_INLIST_CONTAINER_GET(pd->children, _Eo_Object)); 2068 child = _eo_obj_id_get(EINA_INLIST_CONTAINER_GET(pd->children, _Eo_Object));
2069 efl_parent_set(child, NULL); 2069 efl_del(child);
2070 } 2070 }
2071 } 2071 }
2072 2072
@@ -2089,8 +2089,9 @@ _efl_object_destructor(Eo *obj, Efl_Object_Data *pd)
2089 2089
2090 if (EINA_UNLIKELY(pd->parent != NULL)) 2090 if (EINA_UNLIKELY(pd->parent != NULL))
2091 { 2091 {
2092 if (EINA_LIKELY(!pd->allow_parent_unref)) 2092 EO_OBJ_POINTER(obj, obj_data);
2093 ERR("Object '%p' still has a parent at the time of destruction.", obj); 2093 ERR("Object '%s@%p' still has a parent at the time of destruction.",
2094 obj_data->klass->desc->name, obj);
2094 efl_parent_set(obj, NULL); 2095 efl_parent_set(obj, NULL);
2095 } 2096 }
2096 2097
@@ -2122,26 +2123,6 @@ _efl_object_destructor(Eo *obj, Efl_Object_Data *pd)
2122 _eo_condtor_done(obj); 2123 _eo_condtor_done(obj);
2123} 2124}
2124 2125
2125EOLIAN static void
2126_efl_object_allow_parent_unref_set(Eo *obj_id EINA_UNUSED, Efl_Object_Data *pd, Eina_Bool allow)
2127{
2128 pd->allow_parent_unref = !!allow;
2129}
2130
2131EOLIAN static Eina_Bool
2132_efl_object_allow_parent_unref_get(Eo *obj_id EINA_UNUSED, Efl_Object_Data *pd)
2133{
2134 return pd->allow_parent_unref;
2135}
2136
2137EAPI void
2138___efl_auto_unref_set(Eo *obj_id, Eina_Bool enable)
2139{
2140 // Write-only property
2141 EO_OBJ_POINTER(obj_id, obj);
2142 obj->auto_unref = enable ? 1 : 0;
2143}
2144
2145EOLIAN static Eo * 2126EOLIAN static Eo *
2146_efl_object_finalize(Eo *obj, Efl_Object_Data *pd EINA_UNUSED) 2127_efl_object_finalize(Eo *obj, Efl_Object_Data *pd EINA_UNUSED)
2147{ 2128{
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
121 Eina_Bool del_triggered:1; 121 Eina_Bool del_triggered:1;
122 Eina_Bool destructed:1; 122 Eina_Bool destructed:1;
123 Eina_Bool manual_free:1; 123 Eina_Bool manual_free:1;
124 unsigned char auto_unref : 1; // unref after 1 call - hack for parts 124 Eina_Bool auto_unref:1; // unref after 1 call - hack for parts
125 Eina_Bool was_auto_unref:1; // object has been marked as auto-unref
125}; 126};
126 127
127/* How we search and store the implementations in classes. */ 128/* 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
264 265
265 if (!obj->condtor_done) 266 if (!obj->condtor_done)
266 { 267 {
267 ERR("in %s:%d: func '%s' Object of class '%s' - Not all of the object destructors have been executed.", 268 eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
268 file, line, func_name, klass->desc->name); 269 "Object of class '%s' - Not all of the object "
270 "destructors have been executed.", klass->desc->name);
269 } 271 }
270 /*FIXME: add eo_class_unref(klass) ? - just to clear the caches. */ 272 /*FIXME: add eo_class_unref(klass) ? - just to clear the caches. */
271 273
@@ -308,8 +310,8 @@ _efl_invalidate_internal(_Eo_Object *obj, const char *func_name, const char *fil
308 310
309 if (EINA_UNLIKELY(obj->invalidated)) 311 if (EINA_UNLIKELY(obj->invalidated))
310 { 312 {
311 ERR("in %s:%d: func '%s' Object %p already invalidated.", 313 eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
312 file, line, func_name, obj_id); 314 "Object %p already invalidated.", obj_id);
313 _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR, 315 _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
314 __FUNCTION__, __FILE__, __LINE__); 316 __FUNCTION__, __FILE__, __LINE__);
315 return; 317 return;
@@ -317,9 +319,9 @@ _efl_invalidate_internal(_Eo_Object *obj, const char *func_name, const char *fil
317 319
318 if (EINA_UNLIKELY(obj->invalidate_triggered)) 320 if (EINA_UNLIKELY(obj->invalidate_triggered))
319 { 321 {
320 ERR("in %s:%d: func '%s' Object %p invalidate already triggered. " 322 eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
321 "You wrongly call efl_invalidate() within an invalidator.", 323 "Object %p invalidate already triggered. You wrongly "
322 file, line, func_name, obj_id); 324 "called efl_invalidate() within an invalidator.", obj_id);
323 _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR, 325 _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
324 __FUNCTION__, __FILE__, __LINE__); 326 __FUNCTION__, __FILE__, __LINE__);
325 return; 327 return;
@@ -334,9 +336,10 @@ _efl_invalidate_internal(_Eo_Object *obj, const char *func_name, const char *fil
334 336
335 if (EINA_UNLIKELY(!obj->condtor_done)) 337 if (EINA_UNLIKELY(!obj->condtor_done))
336 { 338 {
337 ERR("in %s:%d: func '%s' Object %p of class '%s' - Not all of the " 339 eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
338 "object invalidators have been executed.", 340 "Object %p of class '%s' - Not all of the "
339 file, line, func_name, obj_id, obj->klass->desc->name); 341 "object invalidators have been executed.",
342 obj_id, obj->klass->desc->name);
340 obj->condtor_done = EINA_FALSE; 343 obj->condtor_done = EINA_FALSE;
341 } 344 }
342 345
@@ -357,8 +360,9 @@ _efl_unref_internal(_Eo_Object *obj, const char *func_name, const char *file, in
357 obj_id = _eo_obj_id_get(obj); 360 obj_id = _eo_obj_id_get(obj);
358 if (obj->refcount < 0) 361 if (obj->refcount < 0)
359 { 362 {
360 ERR("in %s:%d: func '%s' Obj:%p. Refcount (%d) < 0. Too many unrefs.", 363 eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
361 file, line, func_name, obj, obj->refcount); 364 "Object %p reached refcount (%d) < 0. Too many unrefs.",
365 obj, obj->refcount);
362 _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR, 366 _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
363 __FUNCTION__, __FILE__, __LINE__); 367 __FUNCTION__, __FILE__, __LINE__);
364 return; 368 return;
@@ -366,13 +370,21 @@ _efl_unref_internal(_Eo_Object *obj, const char *func_name, const char *file, in
366 370
367 if (!obj->invalidated) 371 if (!obj->invalidated)
368 { 372 {
373 if (!obj->was_auto_unref)
374 {
375 eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
376 "Object %s@%p unref'ed but not yet invalidated.",
377 obj->klass->desc->name, obj_id);
378 _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
379 __FUNCTION__, __FILE__, __LINE__);
380 }
369 _efl_invalidate_internal(obj, func_name, file, line); 381 _efl_invalidate_internal(obj, func_name, file, line);
370 } 382 }
371 383
372 if (obj->destructed) 384 if (obj->destructed)
373 { 385 {
374 ERR("in %s:%d: func '%s' Object %p already destructed.", 386 eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
375 file, line, func_name, obj_id); 387 "Object %p already destructed.", obj_id);
376 _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR, 388 _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
377 __FUNCTION__, __FILE__, __LINE__); 389 __FUNCTION__, __FILE__, __LINE__);
378 return; 390 return;
@@ -380,9 +392,10 @@ _efl_unref_internal(_Eo_Object *obj, const char *func_name, const char *file, in
380 392
381 if (obj->del_triggered) 393 if (obj->del_triggered)
382 { 394 {
383 ERR("in %s:%d: func '%s' Object %p deletion already triggered. " 395 eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
384 "You wrongly call efl_unref() within a destructor.", 396 "Object %p deletion already triggered. "
385 file, line, func_name, obj_id); 397 "You wrongly call efl_unref() within a destructor.",
398 obj_id);
386 _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR, 399 _eo_log_obj_report((Eo_Id) obj_id, EINA_LOG_LEVEL_ERR,
387 __FUNCTION__, __FILE__, __LINE__); 400 __FUNCTION__, __FILE__, __LINE__);
388 return; 401 return;
@@ -416,13 +429,15 @@ _efl_unref_internal(_Eo_Object *obj, const char *func_name, const char *file, in
416 Eo_Xref_Node *xref = EINA_INLIST_CONTAINER_GET(obj->data_xrefs, Eo_Xref_Node); 429 Eo_Xref_Node *xref = EINA_INLIST_CONTAINER_GET(obj->data_xrefs, Eo_Xref_Node);
417 if (obj_id == xref->ref_obj) 430 if (obj_id == xref->ref_obj)
418 { 431 {
419 WRN("in %s:%d: func '%s' Object %p still has a reference to its own data (subclass: %s). Origin: %s:%d", 432 eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_WARN, file, func_name, line,
420 file, line, func_name, obj_id, xref->data_klass, xref->file, xref->line); 433 "Object %p still has a reference to its own data (subclass: %s). Origin: %s:%d",
434 obj_id, xref->data_klass, xref->file, xref->line);
421 } 435 }
422 else 436 else
423 { 437 {
424 ERR("in %s:%d: func '%s' Data of object %p (subclass: %s) is still referenced by object %p. Origin: %s:%d", 438 eina_log_print(_eo_log_dom, EINA_LOG_LEVEL_ERR, file, func_name, line,
425 file, line, func_name, obj_id, xref->data_klass, xref->ref_obj, xref->file, xref->line); 439 "Data of object %p (subclass: %s) is still referenced by object %p. Origin: %s:%d",
440 obj_id, xref->data_klass, xref->ref_obj, xref->file, xref->line);
426 } 441 }
427 442
428 eina_freeq_ptr_main_add(xref, free, sizeof(*xref)); 443 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
121 Efl_Input_Focus_Data *ev; 121 Efl_Input_Focus_Data *ev;
122 Efl_Input_Focus *evt; 122 Efl_Input_Focus *evt;
123 123
124 evt = efl_add(MY_CLASS, efl_parent_get(obj), 124 evt = efl_add(MY_CLASS, efl_parent_get(obj));
125 efl_allow_parent_unref_set(efl_added, EINA_TRUE));
126 ev = efl_data_scope_get(evt, MY_CLASS); 125 ev = efl_data_scope_get(evt, MY_CLASS);
127 if (!ev) return NULL; 126 if (!ev) return NULL;
128 127
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)
106 Efl_Input_Hold_Data *ev; 106 Efl_Input_Hold_Data *ev;
107 Efl_Input_Hold *evt; 107 Efl_Input_Hold *evt;
108 108
109 evt = efl_add(MY_CLASS, efl_parent_get(obj), 109 evt = efl_add(MY_CLASS, efl_parent_get(obj));
110 efl_allow_parent_unref_set(efl_added, EINA_TRUE));
111 ev = efl_data_scope_get(evt, MY_CLASS); 110 ev = efl_data_scope_get(evt, MY_CLASS);
112 if (!ev) return NULL; 111 if (!ev) return NULL;
113 112
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)
197 Efl_Input_Key_Data *ev; 197 Efl_Input_Key_Data *ev;
198 Efl_Input_Key *evt; 198 Efl_Input_Key *evt;
199 199
200 evt = efl_add(MY_CLASS, efl_parent_get(obj), 200 evt = efl_add(MY_CLASS, efl_parent_get(obj));
201 efl_allow_parent_unref_set(efl_added, EINA_TRUE));
202 ev = efl_data_scope_get(evt, MY_CLASS); 201 ev = efl_data_scope_get(evt, MY_CLASS);
203 if (!ev) return NULL; 202 if (!ev) return NULL;
204 203
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
152 Efl_Input_Pointer_Data *ev; 152 Efl_Input_Pointer_Data *ev;
153 Efl_Input_Focus *evt; 153 Efl_Input_Focus *evt;
154 154
155 evt = efl_add(MY_CLASS, efl_parent_get(obj), 155 evt = efl_add(MY_CLASS, efl_parent_get(obj));
156 efl_allow_parent_unref_set(efl_added, EINA_TRUE));
157 ev = efl_data_scope_get(evt, MY_CLASS); 156 ev = efl_data_scope_get(evt, MY_CLASS);
158 if (!ev) return NULL; 157 if (!ev) return NULL;
159 158
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)
198EAPI Evas * 198EAPI Evas *
199evas_new(void) 199evas_new(void)
200{ 200{
201 Evas_Object *eo_obj = efl_add(EVAS_CANVAS_CLASS, NULL); 201 Evas_Object *eo_obj = efl_add(EVAS_CANVAS_CLASS, efl_loop_main_get(EFL_LOOP_CLASS));
202 return eo_obj; 202 return eo_obj;
203} 203}
204 204
@@ -211,6 +211,7 @@ _evas_key_mask_free(void *data)
211EOLIAN static Eo * 211EOLIAN static Eo *
212_evas_canvas_efl_object_constructor(Eo *eo_obj, Evas_Public_Data *e) 212_evas_canvas_efl_object_constructor(Eo *eo_obj, Evas_Public_Data *e)
213{ 213{
214 EINA_SAFETY_ON_NULL_RETURN_VAL(efl_parent_get(eo_obj), NULL);
214 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 215 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
215 216
216 e->evas = eo_obj; 217 e->evas = eo_obj;
@@ -274,7 +275,7 @@ evas_free(Evas *eo_e)
274 return; 275 return;
275 MAGIC_CHECK_END(); 276 MAGIC_CHECK_END();
276 evas_sync(eo_e); 277 evas_sync(eo_e);
277 efl_unref(eo_e); 278 efl_del(eo_e);
278} 279}
279 280
280EOLIAN static void 281EOLIAN 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)
1797 parent = efl_add(SIMPLE_CLASS, NULL); 1797 parent = efl_add(SIMPLE_CLASS, NULL);
1798 obj = efl_add(SIMPLE_CLASS, parent); 1798 obj = efl_add(SIMPLE_CLASS, parent);
1799 fail_if(efl_ref_count(obj) != 1); 1799 fail_if(efl_ref_count(obj) != 1);
1800 efl_allow_parent_unref_set(obj, 1);
1801 efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del); 1800 efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del);
1802 ___efl_auto_unref_set(obj, 1); 1801 ___efl_auto_unref_set(obj, 1);
1803 fail_if(_auto_unref_del); 1802 fail_if(_auto_unref_del);