diff options
author | Tom Hacohen <tom@stosb.com> | 2015-05-20 14:56:45 +0100 |
---|---|---|
committer | Tom Hacohen <tom@stosb.com> | 2015-05-20 16:25:38 +0100 |
commit | 92fb2917cba7b91a83fbfd39b876d585921d6d3e (patch) | |
tree | 4a9aa3641cd5a3ddf706f51a262adfc405d96d9d | |
parent | 7c769163d9eb122412675dca621e83ed7648e60e (diff) |
Eo: Remove eo_error_set() and clean up finalizer()
This is another cleanup in perparation for the Eo stable release.
This is no longer needed thanks to the proper error reporting with
eo_constructor()'s new return value.
The finalizer change cleans it up a bit so it catches more cases/issues.
This also means that the finalizer cleans up the object in all cases,
and not only some.
@feature.
27 files changed, 133 insertions, 76 deletions
diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c index 14c4531aa9..b02d90582d 100644 --- a/src/lib/ecore/ecore_anim.c +++ b/src/lib/ecore/ecore_anim.c | |||
@@ -177,7 +177,6 @@ _ecore_animator_add(Ecore_Animator *obj, | |||
177 | { | 177 | { |
178 | if (EINA_UNLIKELY(!eina_main_loop_is())) | 178 | if (EINA_UNLIKELY(!eina_main_loop_is())) |
179 | { | 179 | { |
180 | eo_error_set(obj); | ||
181 | EINA_MAIN_LOOP_CHECK_RETURN_VAL(EINA_FALSE); | 180 | EINA_MAIN_LOOP_CHECK_RETURN_VAL(EINA_FALSE); |
182 | } | 181 | } |
183 | 182 | ||
@@ -186,7 +185,6 @@ _ecore_animator_add(Ecore_Animator *obj, | |||
186 | 185 | ||
187 | if (!func) | 186 | if (!func) |
188 | { | 187 | { |
189 | eo_error_set(obj); | ||
190 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); | 188 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); |
191 | return EINA_FALSE; | 189 | return EINA_FALSE; |
192 | } | 190 | } |
@@ -526,6 +524,17 @@ _ecore_animator_eo_base_destructor(Eo *obj, Ecore_Animator_Data *pd) | |||
526 | eo_do_super(obj, MY_CLASS, eo_destructor()); | 524 | eo_do_super(obj, MY_CLASS, eo_destructor()); |
527 | } | 525 | } |
528 | 526 | ||
527 | EOLIAN static Eo * | ||
528 | _ecore_animator_eo_base_finalize(Eo *obj, Ecore_Animator_Data *pd) | ||
529 | { | ||
530 | if (!pd->func) | ||
531 | { | ||
532 | return NULL; | ||
533 | } | ||
534 | |||
535 | return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize()); | ||
536 | } | ||
537 | |||
529 | EAPI void | 538 | EAPI void |
530 | ecore_animator_frametime_set(double frametime) | 539 | ecore_animator_frametime_set(double frametime) |
531 | { | 540 | { |
diff --git a/src/lib/ecore/ecore_animator.eo b/src/lib/ecore/ecore_animator.eo index 58f565c301..ff1e21db32 100644 --- a/src/lib/ecore/ecore_animator.eo +++ b/src/lib/ecore/ecore_animator.eo | |||
@@ -22,6 +22,7 @@ class Ecore.Animator (Eo.Base) | |||
22 | } | 22 | } |
23 | implements { | 23 | implements { |
24 | Eo.Base.destructor; | 24 | Eo.Base.destructor; |
25 | Eo.Base.finalize; | ||
25 | Eo.Base.event_freeze; | 26 | Eo.Base.event_freeze; |
26 | Eo.Base.event_thaw; | 27 | Eo.Base.event_thaw; |
27 | } | 28 | } |
diff --git a/src/lib/ecore/ecore_idle_enterer.c b/src/lib/ecore/ecore_idle_enterer.c index 45fd601658..c4091eeea8 100644 --- a/src/lib/ecore/ecore_idle_enterer.c +++ b/src/lib/ecore/ecore_idle_enterer.c | |||
@@ -39,7 +39,6 @@ _ecore_idle_enterer_add(Ecore_Idle_Enterer *obj, | |||
39 | { | 39 | { |
40 | if (EINA_UNLIKELY(!eina_main_loop_is())) | 40 | if (EINA_UNLIKELY(!eina_main_loop_is())) |
41 | { | 41 | { |
42 | eo_error_set(obj); | ||
43 | EINA_MAIN_LOOP_CHECK_RETURN_VAL(EINA_FALSE); | 42 | EINA_MAIN_LOOP_CHECK_RETURN_VAL(EINA_FALSE); |
44 | } | 43 | } |
45 | 44 | ||
@@ -48,7 +47,6 @@ _ecore_idle_enterer_add(Ecore_Idle_Enterer *obj, | |||
48 | 47 | ||
49 | if (!func) | 48 | if (!func) |
50 | { | 49 | { |
51 | eo_error_set(obj); | ||
52 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); | 50 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); |
53 | return EINA_FALSE; | 51 | return EINA_FALSE; |
54 | } | 52 | } |
@@ -135,6 +133,17 @@ _ecore_idle_enterer_eo_base_destructor(Eo *obj, Ecore_Idle_Enterer_Data *idle_en | |||
135 | eo_do_super(obj, MY_CLASS, eo_destructor()); | 133 | eo_do_super(obj, MY_CLASS, eo_destructor()); |
136 | } | 134 | } |
137 | 135 | ||
136 | EOLIAN static Eo * | ||
137 | _ecore_idle_enterer_eo_base_finalize(Eo *obj, Ecore_Idle_Enterer_Data *idle_enterer) | ||
138 | { | ||
139 | if (!idle_enterer->func) | ||
140 | { | ||
141 | return NULL; | ||
142 | } | ||
143 | |||
144 | return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize()); | ||
145 | } | ||
146 | |||
138 | void | 147 | void |
139 | _ecore_idle_enterer_shutdown(void) | 148 | _ecore_idle_enterer_shutdown(void) |
140 | { | 149 | { |
diff --git a/src/lib/ecore/ecore_idle_enterer.eo b/src/lib/ecore/ecore_idle_enterer.eo index f7273f4950..f3cb6899ea 100644 --- a/src/lib/ecore/ecore_idle_enterer.eo +++ b/src/lib/ecore/ecore_idle_enterer.eo | |||
@@ -21,6 +21,7 @@ class Ecore.Idle.Enterer (Eo.Base) | |||
21 | } | 21 | } |
22 | implements { | 22 | implements { |
23 | Eo.Base.destructor; | 23 | Eo.Base.destructor; |
24 | Eo.Base.finalize; | ||
24 | } | 25 | } |
25 | constructors { | 26 | constructors { |
26 | .before_constructor; | 27 | .before_constructor; |
diff --git a/src/lib/ecore/ecore_idle_exiter.c b/src/lib/ecore/ecore_idle_exiter.c index 9f7bff34ac..f8aed55f7b 100644 --- a/src/lib/ecore/ecore_idle_exiter.c +++ b/src/lib/ecore/ecore_idle_exiter.c | |||
@@ -47,7 +47,6 @@ _ecore_idle_exiter_constructor(Eo *obj, Ecore_Idle_Exiter_Data *ie, Ecore_Task_C | |||
47 | _ecore_lock(); | 47 | _ecore_lock(); |
48 | if (EINA_UNLIKELY(!eina_main_loop_is())) | 48 | if (EINA_UNLIKELY(!eina_main_loop_is())) |
49 | { | 49 | { |
50 | eo_error_set(obj); | ||
51 | EINA_MAIN_LOOP_CHECK_RETURN; | 50 | EINA_MAIN_LOOP_CHECK_RETURN; |
52 | } | 51 | } |
53 | 52 | ||
@@ -57,7 +56,6 @@ _ecore_idle_exiter_constructor(Eo *obj, Ecore_Idle_Exiter_Data *ie, Ecore_Task_C | |||
57 | 56 | ||
58 | if (!func) | 57 | if (!func) |
59 | { | 58 | { |
60 | eo_error_set(obj); | ||
61 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); | 59 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); |
62 | return; | 60 | return; |
63 | } | 61 | } |
@@ -93,6 +91,16 @@ _ecore_idle_exiter_del(Ecore_Idle_Exiter *obj) | |||
93 | return idle_exiter->data; | 91 | return idle_exiter->data; |
94 | } | 92 | } |
95 | 93 | ||
94 | EOLIAN static Eo * | ||
95 | _ecore_idle_exiter_eo_base_finalize(Eo *obj, Ecore_Idle_Exiter_Data *idle_exiter) | ||
96 | { | ||
97 | if (!idle_exiter) | ||
98 | { | ||
99 | return NULL; | ||
100 | } | ||
101 | |||
102 | return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize()); | ||
103 | } | ||
96 | 104 | ||
97 | EOLIAN static void | 105 | EOLIAN static void |
98 | _ecore_idle_exiter_eo_base_destructor(Eo *obj, Ecore_Idle_Exiter_Data *idle_exiter) | 106 | _ecore_idle_exiter_eo_base_destructor(Eo *obj, Ecore_Idle_Exiter_Data *idle_exiter) |
diff --git a/src/lib/ecore/ecore_idle_exiter.eo b/src/lib/ecore/ecore_idle_exiter.eo index 1178fd7f2d..6e52f627b3 100644 --- a/src/lib/ecore/ecore_idle_exiter.eo +++ b/src/lib/ecore/ecore_idle_exiter.eo | |||
@@ -13,6 +13,7 @@ class Ecore.Idle.Exiter (Eo.Base) | |||
13 | } | 13 | } |
14 | implements { | 14 | implements { |
15 | Eo.Base.destructor; | 15 | Eo.Base.destructor; |
16 | Eo.Base.finalize; | ||
16 | } | 17 | } |
17 | constructors { | 18 | constructors { |
18 | .constructor; | 19 | .constructor; |
diff --git a/src/lib/ecore/ecore_idler.c b/src/lib/ecore/ecore_idler.c index a61c45c4d5..7c4a73cfbe 100644 --- a/src/lib/ecore/ecore_idler.c +++ b/src/lib/ecore/ecore_idler.c | |||
@@ -50,7 +50,6 @@ _ecore_idler_constructor(Eo *obj, Ecore_Idler_Data *ie, Ecore_Task_Cb func, cons | |||
50 | { | 50 | { |
51 | if (EINA_UNLIKELY(!eina_main_loop_is())) | 51 | if (EINA_UNLIKELY(!eina_main_loop_is())) |
52 | { | 52 | { |
53 | eo_error_set(obj); | ||
54 | EINA_MAIN_LOOP_CHECK_RETURN; | 53 | EINA_MAIN_LOOP_CHECK_RETURN; |
55 | } | 54 | } |
56 | 55 | ||
@@ -59,7 +58,6 @@ _ecore_idler_constructor(Eo *obj, Ecore_Idler_Data *ie, Ecore_Task_Cb func, cons | |||
59 | 58 | ||
60 | if (!func) | 59 | if (!func) |
61 | { | 60 | { |
62 | eo_error_set(obj); | ||
63 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); | 61 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); |
64 | return; | 62 | return; |
65 | } | 63 | } |
@@ -103,6 +101,17 @@ _ecore_idler_eo_base_destructor(Eo *obj, Ecore_Idler_Data *idler) | |||
103 | eo_do_super(obj, MY_CLASS, eo_destructor()); | 101 | eo_do_super(obj, MY_CLASS, eo_destructor()); |
104 | } | 102 | } |
105 | 103 | ||
104 | EOLIAN static Eo * | ||
105 | _ecore_idler_eo_base_finalize(Eo *obj, Ecore_Idler_Data *idler) | ||
106 | { | ||
107 | if (!idler->func) | ||
108 | { | ||
109 | return NULL; | ||
110 | } | ||
111 | |||
112 | return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize()); | ||
113 | } | ||
114 | |||
106 | void | 115 | void |
107 | _ecore_idler_shutdown(void) | 116 | _ecore_idler_shutdown(void) |
108 | { | 117 | { |
diff --git a/src/lib/ecore/ecore_idler.eo b/src/lib/ecore/ecore_idler.eo index fd372a4b77..ed6debbe74 100644 --- a/src/lib/ecore/ecore_idler.eo +++ b/src/lib/ecore/ecore_idler.eo | |||
@@ -13,6 +13,7 @@ class Ecore.Idler (Eo.Base) | |||
13 | } | 13 | } |
14 | implements { | 14 | implements { |
15 | Eo.Base.destructor; | 15 | Eo.Base.destructor; |
16 | Eo.Base.finalize; | ||
16 | } | 17 | } |
17 | constructors { | 18 | constructors { |
18 | .constructor; | 19 | .constructor; |
diff --git a/src/lib/ecore/ecore_job.c b/src/lib/ecore/ecore_job.c index b148f5682e..ed988ab66c 100644 --- a/src/lib/ecore/ecore_job.c +++ b/src/lib/ecore/ecore_job.c | |||
@@ -58,14 +58,12 @@ _ecore_job_constructor(Eo *obj, Ecore_Job_Data *job, Ecore_Cb func, const void * | |||
58 | { | 58 | { |
59 | if (EINA_UNLIKELY(!eina_main_loop_is())) | 59 | if (EINA_UNLIKELY(!eina_main_loop_is())) |
60 | { | 60 | { |
61 | eo_error_set(obj); | ||
62 | EINA_MAIN_LOOP_CHECK_RETURN; | 61 | EINA_MAIN_LOOP_CHECK_RETURN; |
63 | } | 62 | } |
64 | eo_manual_free_set(obj, EINA_TRUE); | 63 | eo_manual_free_set(obj, EINA_TRUE); |
65 | 64 | ||
66 | if (!func) | 65 | if (!func) |
67 | { | 66 | { |
68 | eo_error_set(obj); | ||
69 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); | 67 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); |
70 | return; | 68 | return; |
71 | } | 69 | } |
@@ -73,7 +71,6 @@ _ecore_job_constructor(Eo *obj, Ecore_Job_Data *job, Ecore_Cb func, const void * | |||
73 | job->event = ecore_event_add(ecore_event_job_type, job, _ecore_job_event_free, obj); | 71 | job->event = ecore_event_add(ecore_event_job_type, job, _ecore_job_event_free, obj); |
74 | if (!job->event) | 72 | if (!job->event) |
75 | { | 73 | { |
76 | eo_error_set(obj); | ||
77 | ERR("no event was assigned to object '%p' of class '%s'", obj, MY_CLASS_NAME); | 74 | ERR("no event was assigned to object '%p' of class '%s'", obj, MY_CLASS_NAME); |
78 | return; | 75 | return; |
79 | } | 76 | } |
@@ -102,6 +99,17 @@ _ecore_job_eo_base_destructor(Eo *obj, Ecore_Job_Data *_pd EINA_UNUSED) | |||
102 | eo_do_super(obj, MY_CLASS, eo_destructor()); | 99 | eo_do_super(obj, MY_CLASS, eo_destructor()); |
103 | } | 100 | } |
104 | 101 | ||
102 | EOLIAN static Eo * | ||
103 | _ecore_job_eo_base_finalize(Eo *obj, Ecore_Job_Data *pd) | ||
104 | { | ||
105 | if (!pd->func) | ||
106 | { | ||
107 | return NULL; | ||
108 | } | ||
109 | |||
110 | return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize()); | ||
111 | } | ||
112 | |||
105 | static Eina_Bool | 113 | static Eina_Bool |
106 | _ecore_job_event_handler(void *data EINA_UNUSED, | 114 | _ecore_job_event_handler(void *data EINA_UNUSED, |
107 | int type EINA_UNUSED, | 115 | int type EINA_UNUSED, |
diff --git a/src/lib/ecore/ecore_job.eo b/src/lib/ecore/ecore_job.eo index c9d32b1f4c..3f7082e235 100644 --- a/src/lib/ecore/ecore_job.eo +++ b/src/lib/ecore/ecore_job.eo | |||
@@ -13,6 +13,7 @@ class Ecore.Job (Eo.Base) | |||
13 | } | 13 | } |
14 | implements { | 14 | implements { |
15 | Eo.Base.destructor; | 15 | Eo.Base.destructor; |
16 | Eo.Base.finalize; | ||
16 | } | 17 | } |
17 | constructors { | 18 | constructors { |
18 | .constructor; | 19 | .constructor; |
diff --git a/src/lib/ecore/ecore_poller.c b/src/lib/ecore/ecore_poller.c index 61fb7684e3..348a734dd7 100644 --- a/src/lib/ecore/ecore_poller.c +++ b/src/lib/ecore/ecore_poller.c | |||
@@ -251,7 +251,6 @@ _ecore_poller_constructor(Eo *obj, Ecore_Poller_Data *poller, Ecore_Poller_Type | |||
251 | 251 | ||
252 | if (EINA_UNLIKELY(!eina_main_loop_is())) | 252 | if (EINA_UNLIKELY(!eina_main_loop_is())) |
253 | { | 253 | { |
254 | eo_error_set(obj); | ||
255 | EINA_MAIN_LOOP_CHECK_RETURN; | 254 | EINA_MAIN_LOOP_CHECK_RETURN; |
256 | } | 255 | } |
257 | 256 | ||
@@ -259,7 +258,6 @@ _ecore_poller_constructor(Eo *obj, Ecore_Poller_Data *poller, Ecore_Poller_Type | |||
259 | 258 | ||
260 | if (!func) | 259 | if (!func) |
261 | { | 260 | { |
262 | eo_error_set(obj); | ||
263 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); | 261 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); |
264 | return; | 262 | return; |
265 | } | 263 | } |
@@ -376,6 +374,17 @@ _ecore_poller_eo_base_destructor(Eo *obj, Ecore_Poller_Data *pd) | |||
376 | eo_do_super(obj, MY_CLASS, eo_destructor()); | 374 | eo_do_super(obj, MY_CLASS, eo_destructor()); |
377 | } | 375 | } |
378 | 376 | ||
377 | EOLIAN static Eo * | ||
378 | _ecore_poller_eo_base_finalize(Eo *obj, Ecore_Poller_Data *pd) | ||
379 | { | ||
380 | if (!pd->func) | ||
381 | { | ||
382 | return NULL; | ||
383 | } | ||
384 | |||
385 | return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize()); | ||
386 | } | ||
387 | |||
379 | void | 388 | void |
380 | _ecore_poller_shutdown(void) | 389 | _ecore_poller_shutdown(void) |
381 | { | 390 | { |
diff --git a/src/lib/ecore/ecore_poller.eo b/src/lib/ecore/ecore_poller.eo index a8517ad869..b427d47028 100644 --- a/src/lib/ecore/ecore_poller.eo +++ b/src/lib/ecore/ecore_poller.eo | |||
@@ -37,6 +37,7 @@ class Ecore.Poller (Eo.Base) | |||
37 | } | 37 | } |
38 | implements { | 38 | implements { |
39 | Eo.Base.destructor; | 39 | Eo.Base.destructor; |
40 | Eo.Base.finalize; | ||
40 | } | 41 | } |
41 | constructors { | 42 | constructors { |
42 | .constructor; | 43 | .constructor; |
diff --git a/src/lib/ecore/ecore_timer.c b/src/lib/ecore/ecore_timer.c index e119e9612c..9b828564ee 100644 --- a/src/lib/ecore/ecore_timer.c +++ b/src/lib/ecore/ecore_timer.c | |||
@@ -112,7 +112,6 @@ _ecore_timer_add(Ecore_Timer *obj, | |||
112 | 112 | ||
113 | if (EINA_UNLIKELY(!eina_main_loop_is())) | 113 | if (EINA_UNLIKELY(!eina_main_loop_is())) |
114 | { | 114 | { |
115 | eo_error_set(obj); | ||
116 | EINA_MAIN_LOOP_CHECK_RETURN_VAL(EINA_FALSE); | 115 | EINA_MAIN_LOOP_CHECK_RETURN_VAL(EINA_FALSE); |
117 | } | 116 | } |
118 | 117 | ||
@@ -121,7 +120,6 @@ _ecore_timer_add(Ecore_Timer *obj, | |||
121 | 120 | ||
122 | if (!func) | 121 | if (!func) |
123 | { | 122 | { |
124 | eo_error_set(obj); | ||
125 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); | 123 | ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); |
126 | return EINA_FALSE; | 124 | return EINA_FALSE; |
127 | } | 125 | } |
@@ -465,6 +463,17 @@ _ecore_timer_eo_base_destructor(Eo *obj, Ecore_Timer_Data *pd) | |||
465 | eo_do_super(obj, MY_CLASS, eo_destructor()); | 463 | eo_do_super(obj, MY_CLASS, eo_destructor()); |
466 | } | 464 | } |
467 | 465 | ||
466 | EOLIAN static Eo * | ||
467 | _ecore_timer_eo_base_finalize(Eo *obj, Ecore_Timer_Data *pd) | ||
468 | { | ||
469 | if (!pd->func) | ||
470 | { | ||
471 | return NULL; | ||
472 | } | ||
473 | |||
474 | return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize()); | ||
475 | } | ||
476 | |||
468 | void | 477 | void |
469 | _ecore_timer_shutdown(void) | 478 | _ecore_timer_shutdown(void) |
470 | { | 479 | { |
diff --git a/src/lib/ecore/ecore_timer.eo b/src/lib/ecore/ecore_timer.eo index 35a5b5d852..ff39697637 100644 --- a/src/lib/ecore/ecore_timer.eo +++ b/src/lib/ecore/ecore_timer.eo | |||
@@ -67,6 +67,7 @@ class Ecore.Timer (Eo.Base) | |||
67 | } | 67 | } |
68 | implements { | 68 | implements { |
69 | Eo.Base.destructor; | 69 | Eo.Base.destructor; |
70 | Eo.Base.finalize; | ||
70 | Eo.Base.event_freeze; | 71 | Eo.Base.event_freeze; |
71 | /* XXX: can't document overriden methods | 72 | /* XXX: can't document overriden methods |
72 | * Pauses a running timer. | 73 | * Pauses a running timer. |
diff --git a/src/lib/ecore_con/ecore_con_url.c b/src/lib/ecore_con/ecore_con_url.c index 021b6f22df..348785ce1e 100644 --- a/src/lib/ecore_con/ecore_con_url.c +++ b/src/lib/ecore_con/ecore_con_url.c | |||
@@ -458,17 +458,16 @@ _efl_network_url_eo_base_constructor(Efl_Network_Url *url_obj, Efl_Network_Url_D | |||
458 | { | 458 | { |
459 | url_obj = eo_do_super_ret(url_obj, MY_CLASS, url_obj, eo_constructor()); | 459 | url_obj = eo_do_super_ret(url_obj, MY_CLASS, url_obj, eo_constructor()); |
460 | 460 | ||
461 | if (!_init_count) eo_error_set(url_obj); | 461 | if (!_init_count || !_c_init()) |
462 | if (!_c_init()) | ||
463 | { | 462 | { |
464 | eo_error_set(url_obj); | 463 | ERR("Failed"); |
465 | return NULL; | 464 | return NULL; |
466 | } | 465 | } |
467 | 466 | ||
468 | url_con->curl_easy = _c->curl_easy_init(); | 467 | url_con->curl_easy = _c->curl_easy_init(); |
469 | if (!url_con->curl_easy) | 468 | if (!url_con->curl_easy) |
470 | { | 469 | { |
471 | eo_error_set(url_obj); | 470 | ERR("Failed"); |
472 | return NULL; | 471 | return NULL; |
473 | } | 472 | } |
474 | 473 | ||
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h index bc83ddbddd..5a4014adf0 100644 --- a/src/lib/eo/Eo.h +++ b/src/lib/eo/Eo.h | |||
@@ -623,19 +623,6 @@ EAPI Eo * _eo_add_end(void); | |||
623 | */ | 623 | */ |
624 | EAPI const Eo_Class *eo_class_get(const Eo *obj); | 624 | EAPI const Eo_Class *eo_class_get(const Eo *obj); |
625 | 625 | ||
626 | /** | ||
627 | * @def eo_error_set | ||
628 | * @brief Notify eo that there was an error when constructing, destructing or calling a function of the object. | ||
629 | * @param obj the object to work on. | ||
630 | * | ||
631 | * @see eo_error_get() | ||
632 | */ | ||
633 | #define eo_error_set(obj) eo_error_set_internal(obj, __FILE__, __LINE__) | ||
634 | |||
635 | /* @cond 0 */ | ||
636 | EAPI void eo_error_set_internal(const Eo *obj, const char *file, int line); | ||
637 | /* @endcond */ | ||
638 | |||
639 | #define _eo_add_common(klass, parent, is_ref, ...) \ | 626 | #define _eo_add_common(klass, parent, is_ref, ...) \ |
640 | ( \ | 627 | ( \ |
641 | _eo_do_start(_eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref), \ | 628 | _eo_do_start(_eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref), \ |
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index d5e1d3adb7..dffdcdb639 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c | |||
@@ -935,7 +935,7 @@ _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo | |||
935 | return eo_id; | 935 | return eo_id; |
936 | } | 936 | } |
937 | 937 | ||
938 | Eo * | 938 | static Eo * |
939 | _eo_add_internal_end(Eo *eo_id) | 939 | _eo_add_internal_end(Eo *eo_id) |
940 | { | 940 | { |
941 | Eo_Stack_Frame *fptr; | 941 | Eo_Stack_Frame *fptr; |
@@ -943,7 +943,7 @@ _eo_add_internal_end(Eo *eo_id) | |||
943 | 943 | ||
944 | fptr = stack->frame_ptr; | 944 | fptr = stack->frame_ptr; |
945 | 945 | ||
946 | if ((fptr == NULL) || (fptr->eo_id != eo_id)) | 946 | if ((fptr == NULL) || (eo_id && (fptr->eo_id != eo_id))) |
947 | { | 947 | { |
948 | ERR("Something very wrong happend to the call stack."); | 948 | ERR("Something very wrong happend to the call stack."); |
949 | return NULL; | 949 | return NULL; |
@@ -955,16 +955,23 @@ _eo_add_internal_end(Eo *eo_id) | |||
955 | return NULL; | 955 | return NULL; |
956 | } | 956 | } |
957 | 957 | ||
958 | if (!fptr->o.obj->condtor_done || fptr->o.obj->do_error) | ||
959 | { | 958 | { |
960 | const _Eo_Class *klass = (fptr->cur_klass) ? | 959 | const _Eo_Class *klass = (fptr->cur_klass) ? |
961 | fptr->cur_klass : fptr->o.obj->klass; | 960 | fptr->cur_klass : fptr->o.obj->klass; |
962 | ERR("Object of class '%s' - Not all of the object constructors have been executed.", | 961 | |
963 | klass->desc->name); | 962 | if (!fptr->o.obj->condtor_done) |
964 | /* Unref twice, once for the ref in _eo_add_internal_start, and once for the basic object ref. */ | 963 | { |
965 | _eo_unref(fptr->o.obj); | 964 | ERR("Object of class '%s' - Not all of the object constructors have been executed.", |
966 | _eo_unref(fptr->o.obj); | 965 | klass->desc->name); |
967 | return NULL; | 966 | goto cleanup; |
967 | } | ||
968 | |||
969 | if (!eo_id) | ||
970 | { | ||
971 | ERR("Object of class '%s' - Finalizing the object failed.", | ||
972 | klass->desc->name); | ||
973 | goto cleanup; | ||
974 | } | ||
968 | } | 975 | } |
969 | 976 | ||
970 | fptr->o.obj->finalized = EINA_TRUE; | 977 | fptr->o.obj->finalized = EINA_TRUE; |
@@ -972,12 +979,19 @@ _eo_add_internal_end(Eo *eo_id) | |||
972 | _eo_unref(fptr->o.obj); | 979 | _eo_unref(fptr->o.obj); |
973 | 980 | ||
974 | return (Eo *)eo_id; | 981 | return (Eo *)eo_id; |
982 | |||
983 | cleanup: | ||
984 | /* Unref twice, once for the ref in _eo_add_internal_start, and once for the basic object ref. */ | ||
985 | _eo_unref(fptr->o.obj); | ||
986 | _eo_unref(fptr->o.obj); | ||
987 | return NULL; | ||
975 | } | 988 | } |
976 | 989 | ||
977 | EAPI Eo * | 990 | EAPI Eo * |
978 | _eo_add_end(void) | 991 | _eo_add_end(void) |
979 | { | 992 | { |
980 | Eo *ret = eo_finalize(); | 993 | Eo *ret = eo_finalize(); |
994 | ret = _eo_add_internal_end(ret); | ||
981 | _eo_do_end(); | 995 | _eo_do_end(); |
982 | return ret; | 996 | return ret; |
983 | } | 997 | } |
@@ -1588,16 +1602,6 @@ eo_ref_get(const Eo *obj_id) | |||
1588 | return obj->refcount; | 1602 | return obj->refcount; |
1589 | } | 1603 | } |
1590 | 1604 | ||
1591 | EAPI void | ||
1592 | eo_error_set_internal(const Eo *obj_id, const char *file, int line) | ||
1593 | { | ||
1594 | EO_OBJ_POINTER_RETURN(obj_id, obj); | ||
1595 | |||
1596 | ERR("Error with obj '%p' at %s:%d.", obj, file, line); | ||
1597 | |||
1598 | obj->do_error = EINA_TRUE; | ||
1599 | } | ||
1600 | |||
1601 | void | 1605 | void |
1602 | _eo_condtor_done(Eo *obj_id) | 1606 | _eo_condtor_done(Eo *obj_id) |
1603 | { | 1607 | { |
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c index a263c1ec64..1dbd6f0358 100644 --- a/src/lib/eo/eo_base_class.c +++ b/src/lib/eo/eo_base_class.c | |||
@@ -997,7 +997,7 @@ _eo_base_destructor(Eo *obj, Eo_Base_Data *pd) | |||
997 | EOLIAN static Eo * | 997 | EOLIAN static Eo * |
998 | _eo_base_finalize(Eo *obj, Eo_Base_Data *pd EINA_UNUSED) | 998 | _eo_base_finalize(Eo *obj, Eo_Base_Data *pd EINA_UNUSED) |
999 | { | 999 | { |
1000 | return _eo_add_internal_end(obj); | 1000 | return obj; |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | EOLIAN static void | 1003 | EOLIAN static void |
diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h index 73c6ee2870..3a18dde57e 100644 --- a/src/lib/eo/eo_private.h +++ b/src/lib/eo/eo_private.h | |||
@@ -76,7 +76,6 @@ static inline void _eo_id_release(const Eo_Id obj_id); | |||
76 | /* Free all the entries and the tables */ | 76 | /* Free all the entries and the tables */ |
77 | static inline void _eo_free_ids_tables(void); | 77 | static inline void _eo_free_ids_tables(void); |
78 | 78 | ||
79 | Eo *_eo_add_internal_end(Eo *obj); | ||
80 | void _eo_condtor_done(Eo *obj); | 79 | void _eo_condtor_done(Eo *obj); |
81 | 80 | ||
82 | struct _Eo_Base | 81 | struct _Eo_Base |
@@ -101,7 +100,6 @@ struct _Eo_Object | |||
101 | int refcount; | 100 | int refcount; |
102 | int datarefcount; | 101 | int datarefcount; |
103 | 102 | ||
104 | Eina_Bool do_error:1; | ||
105 | Eina_Bool condtor_done:1; | 103 | Eina_Bool condtor_done:1; |
106 | Eina_Bool finalized:1; | 104 | Eina_Bool finalized:1; |
107 | 105 | ||
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 5e59dbb835..366e341e94 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c | |||
@@ -309,7 +309,7 @@ _evas_object_image_cleanup(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, | |||
309 | } | 309 | } |
310 | 310 | ||
311 | static Eina_Bool | 311 | static Eina_Bool |
312 | _init_cow(Eo *eo_obj) | 312 | _init_cow(void) |
313 | { | 313 | { |
314 | if (!evas_object_image_load_opts_cow || | 314 | if (!evas_object_image_load_opts_cow || |
315 | !evas_object_image_pixels_cow || | 315 | !evas_object_image_pixels_cow || |
@@ -335,7 +335,7 @@ _init_cow(Eo *eo_obj) | |||
335 | !evas_object_image_pixels_cow || | 335 | !evas_object_image_pixels_cow || |
336 | !evas_object_image_state_cow) | 336 | !evas_object_image_state_cow) |
337 | { | 337 | { |
338 | eo_error_set(eo_obj); | 338 | ERR("Failed to init cow."); |
339 | return EINA_FALSE; | 339 | return EINA_FALSE; |
340 | } | 340 | } |
341 | 341 | ||
@@ -358,7 +358,7 @@ _evas_image_eo_base_constructor(Eo *eo_obj, Evas_Image_Data *o) | |||
358 | evas_object_image_init(eo_obj); | 358 | evas_object_image_init(eo_obj); |
359 | evas_object_inject(eo_obj, obj, eo_e); | 359 | evas_object_inject(eo_obj, obj, eo_e); |
360 | 360 | ||
361 | if (!_init_cow(eo_obj)) | 361 | if (!_init_cow()) |
362 | return NULL; | 362 | return NULL; |
363 | 363 | ||
364 | o->load_opts = eina_cow_alloc(evas_object_image_load_opts_cow); | 364 | o->load_opts = eina_cow_alloc(evas_object_image_load_opts_cow); |
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index c77db68300..f6adda729f 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c | |||
@@ -95,7 +95,7 @@ _evas_object_eo_base_constructor(Eo *eo_obj, Evas_Object_Protected_Data *obj) | |||
95 | 95 | ||
96 | if (!obj || !_init_cow() || !eo_isa(parent, EVAS_COMMON_INTERFACE_INTERFACE)) | 96 | if (!obj || !_init_cow() || !eo_isa(parent, EVAS_COMMON_INTERFACE_INTERFACE)) |
97 | { | 97 | { |
98 | eo_error_set(eo_obj); | 98 | ERR("Failed"); |
99 | return NULL; | 99 | return NULL; |
100 | } | 100 | } |
101 | 101 | ||
diff --git a/src/lib/evas/canvas/evas_vg_node.c b/src/lib/evas/canvas/evas_vg_node.c index cfe5b40fae..ad0817efa6 100644 --- a/src/lib/evas/canvas/evas_vg_node.c +++ b/src/lib/evas/canvas/evas_vg_node.c | |||
@@ -247,8 +247,10 @@ _efl_vg_base_eo_base_constructor(Eo *obj, | |||
247 | 247 | ||
248 | obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); | 248 | obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); |
249 | 249 | ||
250 | if (!_efl_vg_base_parent_checked_get(obj, &parent, &cd)) | 250 | if (!_efl_vg_base_parent_checked_get(obj, &parent, &cd)) { |
251 | eo_error_set(obj); | 251 | ERR("Failed"); |
252 | return NULL; | ||
253 | } | ||
252 | 254 | ||
253 | eo_do(obj, eo_event_callback_add(EFL_GFX_CHANGED, _efl_vg_base_property_changed, pd)); | 255 | eo_do(obj, eo_event_callback_add(EFL_GFX_CHANGED, _efl_vg_base_property_changed, pd)); |
254 | pd->changed = EINA_TRUE; | 256 | pd->changed = EINA_TRUE; |
@@ -309,7 +311,6 @@ _efl_vg_base_eo_base_parent_set(Eo *obj, | |||
309 | return ; | 311 | return ; |
310 | 312 | ||
311 | on_error: | 313 | on_error: |
312 | eo_error_set(obj); | ||
313 | return ; | 314 | return ; |
314 | } | 315 | } |
315 | 316 | ||
@@ -338,7 +339,7 @@ _efl_vg_base_efl_gfx_stack_raise(Eo *obj, Efl_VG_Base_Data *pd EINA_UNUSED) | |||
338 | return ; | 339 | return ; |
339 | 340 | ||
340 | on_error: | 341 | on_error: |
341 | eo_error_set(obj); | 342 | ERR("Err"); |
342 | } | 343 | } |
343 | 344 | ||
344 | static void | 345 | static void |
@@ -368,7 +369,7 @@ _efl_vg_base_efl_gfx_stack_stack_above(Eo *obj, | |||
368 | return ; | 369 | return ; |
369 | 370 | ||
370 | on_error: | 371 | on_error: |
371 | eo_error_set(obj); | 372 | ERR("Err"); |
372 | } | 373 | } |
373 | 374 | ||
374 | static void | 375 | static void |
@@ -398,7 +399,7 @@ _efl_vg_base_efl_gfx_stack_stack_below(Eo *obj, | |||
398 | return ; | 399 | return ; |
399 | 400 | ||
400 | on_error: | 401 | on_error: |
401 | eo_error_set(obj); | 402 | ERR("Err"); |
402 | } | 403 | } |
403 | 404 | ||
404 | static void | 405 | static void |
@@ -426,7 +427,7 @@ _efl_vg_base_efl_gfx_stack_lower(Eo *obj, Efl_VG_Base_Data *pd EINA_UNUSED) | |||
426 | return ; | 427 | return ; |
427 | 428 | ||
428 | on_error: | 429 | on_error: |
429 | eo_error_set(obj); | 430 | ERR("Err"); |
430 | } | 431 | } |
431 | 432 | ||
432 | static Eo * | 433 | static Eo * |
diff --git a/src/lib/evas/canvas/evas_vg_root_node.c b/src/lib/evas/canvas/evas_vg_root_node.c index 1d9b573405..0f06d46fe7 100644 --- a/src/lib/evas/canvas/evas_vg_root_node.c +++ b/src/lib/evas/canvas/evas_vg_root_node.c | |||
@@ -56,7 +56,7 @@ _efl_vg_root_node_eo_base_parent_set(Eo *obj, | |||
56 | eo_do_super(obj, EFL_VG_BASE_CLASS, eo_parent_set(parent)); | 56 | eo_do_super(obj, EFL_VG_BASE_CLASS, eo_parent_set(parent)); |
57 | if (parent && !eo_isa(parent, EVAS_VG_CLASS)) | 57 | if (parent && !eo_isa(parent, EVAS_VG_CLASS)) |
58 | { | 58 | { |
59 | eo_error_set(obj); | 59 | ERR("Parent of VG_ROOT_NODE must be a VG_CLASS"); |
60 | } | 60 | } |
61 | else | 61 | else |
62 | { | 62 | { |
@@ -76,8 +76,10 @@ _efl_vg_root_node_eo_base_constructor(Eo *obj, | |||
76 | // Nice little hack, jump over parent constructor in Efl_VG_Root | 76 | // Nice little hack, jump over parent constructor in Efl_VG_Root |
77 | obj = eo_do_super_ret(obj, EFL_VG_BASE_CLASS, obj, eo_constructor()); | 77 | obj = eo_do_super_ret(obj, EFL_VG_BASE_CLASS, obj, eo_constructor()); |
78 | eo_do(obj, parent = eo_parent_get()); | 78 | eo_do(obj, parent = eo_parent_get()); |
79 | if (!eo_isa(parent, EVAS_VG_CLASS)) | 79 | if (!eo_isa(parent, EVAS_VG_CLASS)) { |
80 | eo_error_set(obj); | 80 | ERR("Parent of VG_ROOT_NODE must be a VG_CLASS"); |
81 | return NULL; | ||
82 | } | ||
81 | 83 | ||
82 | cd = eo_data_scope_get(obj, EFL_VG_CONTAINER_CLASS); | 84 | cd = eo_data_scope_get(obj, EFL_VG_CONTAINER_CLASS); |
83 | cd->children = NULL; | 85 | cd->children = NULL; |
diff --git a/src/tests/eo/constructors/constructors_simple.c b/src/tests/eo/constructors/constructors_simple.c index ed22905ade..6954bebe0c 100644 --- a/src/tests/eo/constructors/constructors_simple.c +++ b/src/tests/eo/constructors/constructors_simple.c | |||
@@ -53,10 +53,13 @@ _finalize(Eo *obj, void *class_data EINA_UNUSED) | |||
53 | Eo *ret; | 53 | Eo *ret; |
54 | Private_Data *pd = class_data; | 54 | Private_Data *pd = class_data; |
55 | 55 | ||
56 | if (pd->a < 0) eo_error_set(obj); | ||
57 | |||
58 | eo_do_super(obj, MY_CLASS, ret = eo_finalize()); | 56 | eo_do_super(obj, MY_CLASS, ret = eo_finalize()); |
59 | 57 | ||
58 | if (pd->a < 0) | ||
59 | { | ||
60 | return NULL; | ||
61 | } | ||
62 | |||
60 | return ret; | 63 | return ret; |
61 | } | 64 | } |
62 | 65 | ||
diff --git a/src/tests/eo/constructors/constructors_simple2.c b/src/tests/eo/constructors/constructors_simple2.c index b1b6bbe71f..fdda2a60ec 100644 --- a/src/tests/eo/constructors/constructors_simple2.c +++ b/src/tests/eo/constructors/constructors_simple2.c | |||
@@ -13,8 +13,7 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED) | |||
13 | { | 13 | { |
14 | obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); | 14 | obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); |
15 | 15 | ||
16 | eo_error_set(obj); | 16 | return NULL; |
17 | return obj; | ||
18 | } | 17 | } |
19 | 18 | ||
20 | static Eo_Op_Description op_descs[] = { | 19 | static Eo_Op_Description op_descs[] = { |
diff --git a/src/tests/eo/constructors/constructors_simple6.c b/src/tests/eo/constructors/constructors_simple6.c index 3f4c70e480..5b3f485c68 100644 --- a/src/tests/eo/constructors/constructors_simple6.c +++ b/src/tests/eo/constructors/constructors_simple6.c | |||
@@ -12,8 +12,6 @@ static void | |||
12 | _destructor(Eo *obj, void *class_data EINA_UNUSED) | 12 | _destructor(Eo *obj, void *class_data EINA_UNUSED) |
13 | { | 13 | { |
14 | eo_do_super(obj, MY_CLASS, eo_destructor()); | 14 | eo_do_super(obj, MY_CLASS, eo_destructor()); |
15 | |||
16 | eo_error_set(obj); | ||
17 | } | 15 | } |
18 | 16 | ||
19 | static Eo_Op_Description op_descs [] = { | 17 | static Eo_Op_Description op_descs [] = { |
diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c index bb4f4ed291..59cb4db92a 100644 --- a/src/tests/eo/suite/eo_test_general.c +++ b/src/tests/eo/suite/eo_test_general.c | |||
@@ -683,8 +683,6 @@ START_TEST(eo_magic_checks) | |||
683 | fail_if(wref); | 683 | fail_if(wref); |
684 | fail_if(parent); | 684 | fail_if(parent); |
685 | 685 | ||
686 | eo_error_set((Eo *) buf); | ||
687 | |||
688 | fail_if(eo_data_scope_get((Eo *) buf, SIMPLE_CLASS)); | 686 | fail_if(eo_data_scope_get((Eo *) buf, SIMPLE_CLASS)); |
689 | 687 | ||
690 | eo_do(obj, eo_composite_attach((Eo *) buf)); | 688 | eo_do(obj, eo_composite_attach((Eo *) buf)); |