summaryrefslogtreecommitdiff
path: root/legacy/eobj
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2012-09-12 11:31:58 +0000
committerTom Hacohen <tom@stosb.com>2012-09-12 11:31:58 +0000
commit0ef7b93bf99c7d6ce062a169350e42a1eca30d04 (patch)
treedd016be6423cc5f872ad77d5f4ff82bdfe5f6586 /legacy/eobj
parent4791a710f27507179ef9f1707de4538234517255 (diff)
Eo: Added eo_destructed_is.
SVN revision: 76518
Diffstat (limited to 'legacy/eobj')
-rw-r--r--legacy/eobj/src/lib/Eo.h11
-rw-r--r--legacy/eobj/src/lib/eo.c8
-rw-r--r--legacy/eobj/src/tests/eo_suite/eo_test_general.c4
3 files changed, 23 insertions, 0 deletions
diff --git a/legacy/eobj/src/lib/Eo.h b/legacy/eobj/src/lib/Eo.h
index 08f0a1aa0a..ffb46fbeac 100644
--- a/legacy/eobj/src/lib/Eo.h
+++ b/legacy/eobj/src/lib/Eo.h
@@ -744,6 +744,17 @@ EAPI void eo_manual_free_set(Eo *obj, Eina_Bool manual_free);
744EAPI void eo_manual_free(Eo *obj); 744EAPI void eo_manual_free(Eo *obj);
745 745
746/** 746/**
747 * @brief Checks if the object was already descructed (only relevant for manual_free objects).
748 * @param obj the object to check.
749 * This function checks if the object was already destructed (but not alraedy
750 * freed). It should only be used with objects that are supposed to be manually
751 * freed, but not yet freed (but possibly destructed).
752 *
753 * @see eo_manual_free_set()
754 */
755EAPI Eina_Bool eo_destructed_is(const Eo *obj);
756
757/**
747 * @addtogroup Eo_Composite_Objects Composite Objects. 758 * @addtogroup Eo_Composite_Objects Composite Objects.
748 * @{ 759 * @{
749 */ 760 */
diff --git a/legacy/eobj/src/lib/eo.c b/legacy/eobj/src/lib/eo.c
index 59e11f3c44..9eaba3debe 100644
--- a/legacy/eobj/src/lib/eo.c
+++ b/legacy/eobj/src/lib/eo.c
@@ -1545,6 +1545,14 @@ eo_composite_is(const Eo *comp_obj)
1545 return comp_obj->composite; 1545 return comp_obj->composite;
1546} 1546}
1547 1547
1548EAPI Eina_Bool
1549eo_destructed_is(const Eo *obj)
1550{
1551 EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, EINA_FALSE);
1552
1553 return obj->del;
1554}
1555
1548EAPI void 1556EAPI void
1549eo_manual_free_set(Eo *obj, Eina_Bool manual_free) 1557eo_manual_free_set(Eo *obj, Eina_Bool manual_free)
1550{ 1558{
diff --git a/legacy/eobj/src/tests/eo_suite/eo_test_general.c b/legacy/eobj/src/tests/eo_suite/eo_test_general.c
index 0de71dc0a0..0ab8153999 100644
--- a/legacy/eobj/src/tests/eo_suite/eo_test_general.c
+++ b/legacy/eobj/src/tests/eo_suite/eo_test_general.c
@@ -231,12 +231,15 @@ START_TEST(eo_man_free)
231 obj = eo_add(klass, NULL); 231 obj = eo_add(klass, NULL);
232 fail_if(!obj); 232 fail_if(!obj);
233 eo_manual_free(obj); 233 eo_manual_free(obj);
234 fail_if(eo_destructed_is(obj));
234 eo_unref(obj); 235 eo_unref(obj);
236 fail_if(!eo_destructed_is(obj));
235 eo_manual_free(obj); 237 eo_manual_free(obj);
236 238
237 obj = eo_add(klass, NULL); 239 obj = eo_add(klass, NULL);
238 fail_if(!obj); 240 fail_if(!obj);
239 eo_unref(obj); 241 eo_unref(obj);
242 fail_if(!eo_destructed_is(obj));
240 eo_manual_free(obj); 243 eo_manual_free(obj);
241 244
242 _man_should_con = EINA_FALSE; 245 _man_should_con = EINA_FALSE;
@@ -618,6 +621,7 @@ START_TEST(eo_magic_checks)
618 621
619 eo_manual_free_set((Eo *) buf, EINA_TRUE); 622 eo_manual_free_set((Eo *) buf, EINA_TRUE);
620 eo_manual_free((Eo *) buf); 623 eo_manual_free((Eo *) buf);
624 eo_destructed_is((Eo *) buf);
621 625
622 eo_unref(obj); 626 eo_unref(obj);
623 627