From 3c8e1cc276f7a2df293d1ac4cf81fe4317ede6cb Mon Sep 17 00:00:00 2001 From: Jee-Yong Um Date: Tue, 10 May 2016 15:46:55 -0700 Subject: [PATCH] edje_cc: cleanup queued jobs for removed program Summary: When a new edje program is created, some jobs like lookup part (Part_Lookup) or compiling embryo script (Code_Program) are queued. If program is removed, queued jobs should be removed also. Reviewers: jpeg, cedric Reviewed By: cedric Differential Revision: https://phab.enlightenment.org/D3900 Signed-off-by: Cedric Bail Change-Id: I349090630706e5e4c3cb43feb251b776e2f9c19a --- src/bin/edje/edje_cc_handlers.c | 10 +++++++++- src/bin/edje/edje_cc_out.c | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index cafb434..87661e4 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c @@ -1631,6 +1631,8 @@ _edje_program_check(const char *name, Edje_Program *me, Edje_Program **pgrms, un { _edje_program_remove(pc, me); current_program = pgrms[i]; + if (pgrms[i]->action == EDJE_ACTION_TYPE_SCRIPT) + copied_program_anonymous_lookup_delete(pc, &pgrms[i]->id); epp->can_override = EINA_FALSE; return; } @@ -5326,9 +5328,12 @@ st_collections_group_parts_part_inherit(void) static void _program_free(Edje_Program *pr) { + Edje_Part_Collection *pc; Edje_Program_Target *prt; Edje_Program_After *pa; + pc = eina_list_last_data_get(edje_collections); + free((void*)pr->name); free((void*)pr->signal); free((void*)pr->source); @@ -5339,7 +5344,10 @@ _program_free(Edje_Program *pr) free((void*)pr->sample_name); free((void*)pr->tone_name); EINA_LIST_FREE(pr->targets, prt) - free(prt); + { + part_lookup_del(pc, &prt->id); + free(prt); + } EINA_LIST_FREE(pr->after, pa) free(pa); free(pr); diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index eaa9620..0d0382d 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -2856,6 +2856,25 @@ copied_program_anonymous_lookup_delete(Edje_Part_Collection *pc, int *dest) { if ((!pl->anonymous) || (pl->pc != pc) || (dest != &pl->u.ep->id)) continue; program_lookups = eina_list_remove_list(program_lookups, l); + + Code *cd; + Code_Program *cp; + Edje_Part_Collection_Directory_Entry *de; + Eina_List *l, *ll; + + de = eina_hash_find(edje_file->collection, pl->pc->part); + cd = eina_list_nth(codes, de->id); + + EINA_LIST_FOREACH_SAFE(cd->programs, l, ll, cp) + { + if (pl->dest == &cp->id) + { + cd->programs = eina_list_remove(cd->programs, cp); + free(cp); + break; + } + } + free(pl); } } -- 2.7.4