From 8bc7342977bdab60c812d492193906997d282b2e Mon Sep 17 00:00:00 2001 From: tasn Date: Sun, 10 Jun 2012 14:04:58 +0000 Subject: [PATCH] Eo: error when calling constructor/destructor out of context. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/PROTO/eobj@71900 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- lib/eo.c | 6 ++++++ tests/eo_test_general.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/lib/eo.c b/lib/eo.c index a3f5125..e67a917 100644 --- a/lib/eo.c +++ b/lib/eo.c @@ -1361,6 +1361,12 @@ _eo_error_unset(Eo *obj) void _eo_condtor_done(Eo *obj) { + if (obj->condtor_done) + { + ERR("Object %p is already constructed at this point.", obj); + return; + } + obj->condtor_done = EINA_TRUE; } diff --git a/tests/eo_test_general.c b/tests/eo_test_general.c index bba143c..e784afb 100644 --- a/tests/eo_test_general.c +++ b/tests/eo_test_general.c @@ -15,6 +15,12 @@ START_TEST(eo_simple) Eo *obj = eo_add(EO_BASE_CLASS, NULL); fail_if(obj); + obj = eo_add(SIMPLE_CLASS, NULL); + fail_if(!obj); + eo_do(obj, eo_constructor()); + eo_do(obj, eo_destructor()); + eo_unref(obj); + eo_shutdown(); } END_TEST -- 2.7.4