edje_cc: cleanup queued jobs for removed program 72/87272/5
authorJee-Yong Um <jc9.um@samsung.com>
Tue, 10 May 2016 22:46:55 +0000 (15:46 -0700)
committerSungtaek Hong <sth253.hong@samsung.com>
Mon, 19 Sep 2016 08:30:08 +0000 (01:30 -0700)
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 <cedric@osg.samsung.com>
Change-Id: I349090630706e5e4c3cb43feb251b776e2f9c19a

src/bin/edje/edje_cc_handlers.c
src/bin/edje/edje_cc_out.c

index cafb434..87661e4 100644 (file)
@@ -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);
index eaa9620..0d0382d 100644 (file)
@@ -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);
      }
 }