summaryrefslogtreecommitdiff
path: root/src/bin/edje
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-01-17 15:11:25 -0500
committerMike Blumenkrantz <zmike@samsung.com>2019-01-17 15:11:26 -0500
commitc7e29cd1c1fa8fd6e8bb9f2a687c807d3b55b7ab (patch)
tree0cfe3b9b453622b6621f1cc613447c00db528e4a /src/bin/edje
parent1e5c25b4ec7ea731873c83d80bd60d5672548c29 (diff)
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
Diffstat (limited to 'src/bin/edje')
-rw-r--r--src/bin/edje/edje_cc_out.c30
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)
750 750
751 EINA_LIST_FOREACH(ep->targets, l, et) 751 EINA_LIST_FOREACH(ep->targets, l, et)
752 { 752 {
753 Edje_Part *part;
754
755 part = pc->parts[et->id];
756 /* verify existence of description in part */
757 if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
758 {
759 if ((!eina_streq(ep->state, "custom")) &&
760 ((!eina_streq(ep->state, "default")) || (!EINA_DBL_EQ(ep->value, 0.0))))
761 {
762 Edje_Part_Collection_Directory_Entry *de;
763 Eina_Bool found = EINA_FALSE;
764 for (i = 0; i < part->other.desc_count; i++)
765 {
766 Edje_Part_Description_Common *ed = part->other.desc[i];
767 if (eina_streq(ed->state.name, ep->state) && EINA_DBL_EQ(ep->value, ed->state.value))
768 {
769 found = EINA_TRUE;
770 break;
771 }
772 }
773 if (!found)
774 {
775 de = eina_hash_find(edje_collections_lookup, &pc->id);
776 error_and_abort(NULL, "GROUP %s - state '%s:%g' does not exist for part '%s'; set in program '%s'",
777 de->entry, ep->state, ep->value, part->name, ep->name);
778 }
779 }
780 }
753 if (((ep->action == EDJE_ACTION_TYPE_STATE_SET) || 781 if (((ep->action == EDJE_ACTION_TYPE_STATE_SET) ||
754 (ep->action == EDJE_ACTION_TYPE_SIGNAL_EMIT)) && 782 (ep->action == EDJE_ACTION_TYPE_SIGNAL_EMIT)) &&
755 (et->id < (int)pc->parts_count) && 783 (et->id < (int)pc->parts_count) &&
756 (pc->parts[et->id]->type == EDJE_PART_TYPE_MESH_NODE) && 784 (part->type == EDJE_PART_TYPE_MESH_NODE) &&
757 (strstr(ep->signal, "mouse"))) 785 (strstr(ep->signal, "mouse")))
758 { 786 {
759 for (i = 0; (i < pc->parts_count) && (ep->source_3d_id < 0); i++) 787 for (i = 0; (i < pc->parts_count) && (ep->source_3d_id < 0); i++)