forked from enlightenment/efl
edje: enhance circular dependency error message of edje calculation
Summary: enhance error message of edje calculation Test Plan: check edje having circular dependency Reviewers: raster, cedric, jpeg Subscribers: seoz Differential Revision: https://phab.enlightenment.org/D3484
This commit is contained in:
parent
7dcd467f24
commit
fe70f0c080
|
@ -3614,6 +3614,117 @@ _edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf,
|
|||
#define Rel1Y 1
|
||||
#define Rel2X 2
|
||||
#define Rel2Y 3
|
||||
Eina_Bool circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Eina_List **clist)
|
||||
{
|
||||
Edje_Real_Part *rp = NULL;
|
||||
|
||||
if (cep && !strcmp(ep->part->name, cep->part->name))
|
||||
{
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
if ((ep->calculating & FLAG_X))
|
||||
{
|
||||
if (ep->param1.description)
|
||||
{
|
||||
if (ep->param1.description->rel1.id_x >= 0)
|
||||
{
|
||||
if (!cep) cep = ep;
|
||||
rp = ed->table_parts[cep->param1.description->rel1.id_x];
|
||||
if (circular_dependency_find(ed, ep, rp, clist))
|
||||
{
|
||||
*clist = eina_list_prepend(*clist, rp->part->name);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
if (ep->param1.description->rel2.id_x >= 0)
|
||||
{
|
||||
if (!cep) cep = ep;
|
||||
rp = ed->table_parts[cep->param1.description->rel2.id_x];
|
||||
if (circular_dependency_find(ed, ep, rp, clist))
|
||||
{
|
||||
*clist = eina_list_prepend(*clist, rp->part->name);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ep->param2)
|
||||
{
|
||||
if (ep->param2->description->rel1.id_x >= 0)
|
||||
{
|
||||
if (!cep) cep = ep;
|
||||
rp = ed->table_parts[cep->param2->description->rel1.id_x];
|
||||
if (circular_dependency_find(ed, ep, rp, clist))
|
||||
{
|
||||
*clist = eina_list_prepend(*clist, rp->part->name);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
if (ep->param2->description->rel2.id_x >= 0)
|
||||
{
|
||||
if (!cep) cep = ep;
|
||||
rp = ed->table_parts[cep->param2->description->rel2.id_x];
|
||||
if (circular_dependency_find(ed, ep, rp, clist))
|
||||
{
|
||||
*clist = eina_list_prepend(*clist, rp->part->name);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((ep->calculating & FLAG_Y))
|
||||
{
|
||||
if (ep->param1.description)
|
||||
{
|
||||
if (ep->param1.description->rel1.id_y >= 0)
|
||||
{
|
||||
if (!cep) cep = ep;
|
||||
rp = ed->table_parts[cep->param1.description->rel1.id_y];
|
||||
if (circular_dependency_find(ed, ep, rp, clist))
|
||||
{
|
||||
*clist = eina_list_prepend(*clist, rp->part->name);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
if (ep->param1.description->rel2.id_y >= 0)
|
||||
{
|
||||
if (!cep) cep = ep;
|
||||
rp = ed->table_parts[cep->param1.description->rel2.id_y];
|
||||
if (circular_dependency_find(ed, ep, rp, clist))
|
||||
{
|
||||
*clist = eina_list_prepend(*clist, rp->part->name);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ep->param2)
|
||||
{
|
||||
if (ep->param2->description->rel1.id_y >= 0)
|
||||
{
|
||||
if (!cep) cep = ep;
|
||||
rp = ed->table_parts[cep->param2->description->rel1.id_y];
|
||||
if (circular_dependency_find(ed, ep, rp, clist))
|
||||
{
|
||||
*clist = eina_list_prepend(*clist, rp->part->name);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
if (ep->param2->description->rel2.id_y >= 0)
|
||||
{
|
||||
if (!cep) cep = ep;
|
||||
rp = ed->table_parts[cep->param2->description->rel2.id_y];
|
||||
if (circular_dependency_find(ed, ep, rp, clist))
|
||||
{
|
||||
*clist = eina_list_prepend(*clist, rp->part->name);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state)
|
||||
|
@ -3686,6 +3797,23 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
|
|||
ep->part->name,
|
||||
axes, ep->calculating,
|
||||
faxes, flags);
|
||||
|
||||
Eina_List *clist = NULL;
|
||||
Eina_List *l = NULL;
|
||||
char *part_name;
|
||||
char depends_path[PATH_MAX] = "";
|
||||
circular_dependency_find(ed, ep, NULL, &clist);
|
||||
strncat(depends_path, ep->part->name,
|
||||
sizeof(ep->part->name) - strlen(ep->part->name) - 1);
|
||||
EINA_LIST_FOREACH(clist, l, part_name)
|
||||
{
|
||||
strncat(depends_path, " -> ",
|
||||
sizeof(depends_path) - strlen(depends_path) - 1);
|
||||
strncat(depends_path, part_name,
|
||||
sizeof(depends_path) - strlen(depends_path) - 1);
|
||||
}
|
||||
ERR("Circular dependency: %s", depends_path);
|
||||
eina_list_free(clist);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue