forked from enlightenment/efl
Eo: Check parent is valid in eo_parent_set.
This is an extension to raster's 0355a6a296
(eo - fix _parent_set in base clase when old_parent_pd is NULL).
I also added an error message in case this check fails.
This commit is contained in:
parent
0355a6a296
commit
cad3cf30a4
|
@ -131,23 +131,35 @@ _parent_set(Eo *obj, void *class_data, va_list *list)
|
|||
Private_Data *old_parent_pd;
|
||||
|
||||
old_parent_pd = eo_data_scope_get(pd->parent, EO_BASE_CLASS);
|
||||
if (old_parent_pd)
|
||||
old_parent_pd->children = eina_list_remove(old_parent_pd->children,
|
||||
obj);
|
||||
eo_xunref(obj, pd->parent);
|
||||
}
|
||||
|
||||
pd->parent = parent_id;
|
||||
if (pd->parent)
|
||||
/* Set new parent */
|
||||
if (parent_id)
|
||||
{
|
||||
Private_Data *parent_pd = NULL;
|
||||
|
||||
parent_pd = eo_data_scope_get(parent_id, EO_BASE_CLASS);
|
||||
if (parent_pd)
|
||||
|
||||
if (EINA_LIKELY(parent_pd != NULL))
|
||||
{
|
||||
pd->parent = parent_id;
|
||||
parent_pd->children = eina_list_append(parent_pd->children,
|
||||
obj);
|
||||
eo_xref(obj, pd->parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->parent = NULL;
|
||||
ERR("New parent %p for object %p is not a valid Eo object.",
|
||||
parent_id, obj);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->parent = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue