diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2019-01-17 15:11:25 -0500 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2019-01-17 15:11:26 -0500 |
commit | c7e29cd1c1fa8fd6e8bb9f2a687c807d3b55b7ab (patch) | |
tree | 0cfe3b9b453622b6621f1cc613447c00db528e4a | |
parent | 1e5c25b4ec7ea731873c83d80bd60d5672548c29 (diff) | |
download | efl-c7e29cd1c1fa8fd6e8bb9f2a687c807d3b55b7ab.tar.gz |
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
-rw-r--r-- | src/bin/edje/edje_cc_out.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index 154e070759..c791e8d1c6 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -750,10 +750,38 @@ check_program(Edje_Part_Collection *pc, Edje_Program *ep, Eet_File *ef) 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) || (ep->action == EDJE_ACTION_TYPE_SIGNAL_EMIT)) && (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"))) { for (i = 0; (i < pc->parts_count) && (ep->source_3d_id < 0); i++) |