forked from enlightenment/efl
parent
4791a710f2
commit
0ef7b93bf9
|
@ -743,6 +743,17 @@ EAPI void eo_manual_free_set(Eo *obj, Eina_Bool manual_free);
|
||||||
*/
|
*/
|
||||||
EAPI void eo_manual_free(Eo *obj);
|
EAPI void eo_manual_free(Eo *obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if the object was already descructed (only relevant for manual_free objects).
|
||||||
|
* @param obj the object to check.
|
||||||
|
* This function checks if the object was already destructed (but not alraedy
|
||||||
|
* freed). It should only be used with objects that are supposed to be manually
|
||||||
|
* freed, but not yet freed (but possibly destructed).
|
||||||
|
*
|
||||||
|
* @see eo_manual_free_set()
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool eo_destructed_is(const Eo *obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup Eo_Composite_Objects Composite Objects.
|
* @addtogroup Eo_Composite_Objects Composite Objects.
|
||||||
* @{
|
* @{
|
||||||
|
|
|
@ -1545,6 +1545,14 @@ eo_composite_is(const Eo *comp_obj)
|
||||||
return comp_obj->composite;
|
return comp_obj->composite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
eo_destructed_is(const Eo *obj)
|
||||||
|
{
|
||||||
|
EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, EINA_FALSE);
|
||||||
|
|
||||||
|
return obj->del;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
eo_manual_free_set(Eo *obj, Eina_Bool manual_free)
|
eo_manual_free_set(Eo *obj, Eina_Bool manual_free)
|
||||||
{
|
{
|
||||||
|
|
|
@ -231,12 +231,15 @@ START_TEST(eo_man_free)
|
||||||
obj = eo_add(klass, NULL);
|
obj = eo_add(klass, NULL);
|
||||||
fail_if(!obj);
|
fail_if(!obj);
|
||||||
eo_manual_free(obj);
|
eo_manual_free(obj);
|
||||||
|
fail_if(eo_destructed_is(obj));
|
||||||
eo_unref(obj);
|
eo_unref(obj);
|
||||||
|
fail_if(!eo_destructed_is(obj));
|
||||||
eo_manual_free(obj);
|
eo_manual_free(obj);
|
||||||
|
|
||||||
obj = eo_add(klass, NULL);
|
obj = eo_add(klass, NULL);
|
||||||
fail_if(!obj);
|
fail_if(!obj);
|
||||||
eo_unref(obj);
|
eo_unref(obj);
|
||||||
|
fail_if(!eo_destructed_is(obj));
|
||||||
eo_manual_free(obj);
|
eo_manual_free(obj);
|
||||||
|
|
||||||
_man_should_con = EINA_FALSE;
|
_man_should_con = EINA_FALSE;
|
||||||
|
@ -618,6 +621,7 @@ START_TEST(eo_magic_checks)
|
||||||
|
|
||||||
eo_manual_free_set((Eo *) buf, EINA_TRUE);
|
eo_manual_free_set((Eo *) buf, EINA_TRUE);
|
||||||
eo_manual_free((Eo *) buf);
|
eo_manual_free((Eo *) buf);
|
||||||
|
eo_destructed_is((Eo *) buf);
|
||||||
|
|
||||||
eo_unref(obj);
|
eo_unref(obj);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue