eo: add an automatic fallback at the moment when efl_unref instead of efl_del is called.

Differential Revision: https://phab.enlightenment.org/D6095
This commit is contained in:
Cedric BAIL 2018-05-03 11:36:28 -07:00
parent c1cef1e74b
commit 79e4947f3e
3 changed files with 14 additions and 0 deletions

View File

@ -1882,6 +1882,15 @@ efl_unref(const Eo *obj_id)
{
EO_OBJ_POINTER_RETURN(obj_id, obj);
if (EINA_UNLIKELY(obj->user_refcount == 1 &&
obj->parent))
{
CRI("Calling efl_unref instead of efl_del or efl_parent_set(NULL). Temporary fallback in place triggered.");
EO_OBJ_DONE(obj_id);
efl_del(obj_id);
return ;
}
if (EINA_UNLIKELY(obj->user_refcount == 1))
{
// The noref event should happen before any object in the

View File

@ -740,12 +740,16 @@ _efl_object_parent_set(Eo *obj, Efl_Object_Data *pd, Eo *parent_id)
// to improve l1 cache efficiency
goto err_parent;
}
eo_obj->parent = EINA_TRUE;
}
else
{
if (prev_parent) _efl_invalidate(eo_obj);
pd->parent = NULL;
eo_obj->parent = EINA_FALSE;
if (prev_parent && !eo_obj->del_triggered) efl_unref(obj);
}

View File

@ -117,6 +117,7 @@ struct _Eo_Object
Eina_Bool super:1;
Eina_Bool invalidate:1;
Eina_Bool is_invalidating:1;
Eina_Bool parent : 1;
Eina_Bool del_triggered:1;
Eina_Bool destructed:1;