forked from enlightenment/efl
edje_cc: fail upon detecting invalid part description references in programs
Summary: this causes attempts to STATE_SET a non-existent state to trigger an error and abort edj file compiling so that bugs can be fixed before they become runtime issues @feature fix T7016 Depends on D7607 Reviewers: cedric Reviewed By: cedric Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7016 Differential Revision: https://phab.enlightenment.org/D7608
This commit is contained in:
parent
1e5c25b4ec
commit
c7e29cd1c1
|
@ -750,10 +750,38 @@ check_program(Edje_Part_Collection *pc, Edje_Program *ep, Eet_File *ef)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(ep->targets, l, et)
|
EINA_LIST_FOREACH(ep->targets, l, et)
|
||||||
{
|
{
|
||||||
|
Edje_Part *part;
|
||||||
|
|
||||||
|
part = pc->parts[et->id];
|
||||||
|
/* verify existence of description in part */
|
||||||
|
if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
|
||||||
|
{
|
||||||
|
if ((!eina_streq(ep->state, "custom")) &&
|
||||||
|
((!eina_streq(ep->state, "default")) || (!EINA_DBL_EQ(ep->value, 0.0))))
|
||||||
|
{
|
||||||
|
Edje_Part_Collection_Directory_Entry *de;
|
||||||
|
Eina_Bool found = EINA_FALSE;
|
||||||
|
for (i = 0; i < part->other.desc_count; i++)
|
||||||
|
{
|
||||||
|
Edje_Part_Description_Common *ed = part->other.desc[i];
|
||||||
|
if (eina_streq(ed->state.name, ep->state) && EINA_DBL_EQ(ep->value, ed->state.value))
|
||||||
|
{
|
||||||
|
found = EINA_TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
de = eina_hash_find(edje_collections_lookup, &pc->id);
|
||||||
|
error_and_abort(NULL, "GROUP %s - state '%s:%g' does not exist for part '%s'; set in program '%s'",
|
||||||
|
de->entry, ep->state, ep->value, part->name, ep->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (((ep->action == EDJE_ACTION_TYPE_STATE_SET) ||
|
if (((ep->action == EDJE_ACTION_TYPE_STATE_SET) ||
|
||||||
(ep->action == EDJE_ACTION_TYPE_SIGNAL_EMIT)) &&
|
(ep->action == EDJE_ACTION_TYPE_SIGNAL_EMIT)) &&
|
||||||
(et->id < (int)pc->parts_count) &&
|
(et->id < (int)pc->parts_count) &&
|
||||||
(pc->parts[et->id]->type == EDJE_PART_TYPE_MESH_NODE) &&
|
(part->type == EDJE_PART_TYPE_MESH_NODE) &&
|
||||||
(strstr(ep->signal, "mouse")))
|
(strstr(ep->signal, "mouse")))
|
||||||
{
|
{
|
||||||
for (i = 0; (i < pc->parts_count) && (ep->source_3d_id < 0); i++)
|
for (i = 0; (i < pc->parts_count) && (ep->source_3d_id < 0); i++)
|
||||||
|
|
Loading…
Reference in New Issue