cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=974daa5f9813b1e2a43a45215859906b74ab4225

commit 974daa5f9813b1e2a43a45215859906b74ab4225
Author: Jee-Yong Um <jc9...@samsung.com>
Date:   Fri Apr 15 11:14:31 2016 -0700

    edje_cc: delete anonymous lookup during program removal
    
    Summary:
    program_remove attribute allows to remove program inherited from
    parent group, but if its action is EDJE_ACTION_TYPE_SCRIPT,
    anonymous lookup also should be deleted.
    
    @fix
    
    Reviewers: cedric, jpeg
    
    Differential Revision: https://phab.enlightenment.org/D3875
    
    Signed-off-by: Cedric Bail <ced...@osg.samsung.com>
---
 src/bin/edje/edje_cc.h          |  1 +
 src/bin/edje/edje_cc_handlers.c | 11 +++++++++++
 src/bin/edje/edje_cc_out.c      | 14 ++++++++++++++
 3 files changed, 26 insertions(+)

diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h
index 65299b5..1ee0362 100644
--- a/src/bin/edje/edje_cc.h
+++ b/src/bin/edje/edje_cc.h
@@ -181,6 +181,7 @@ void   *data_queue_program_lookup(Edje_Part_Collection *pc, 
const char *name, in
 void    program_lookup_rename(void *p, const char *name);
 void    copied_program_lookup_delete(Edje_Part_Collection *pc, const char 
*name);
 void    data_queue_copied_program_lookup(Edje_Part_Collection *pc, int *src, 
int *dest);
+void    copied_program_anonymous_lookup_delete(Edje_Part_Collection *pc, int 
*dest);
 void    data_queue_anonymous_lookup(Edje_Part_Collection *pc, Edje_Program 
*ep, int *dest);
 void    data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, 
int *dest);
 void    data_queue_image_lookup(char *name, int *dest, Eina_Bool *set);
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index f6bc18b..59b1c32 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -166,6 +166,7 @@ Eina_Bool current_group_inherit = EINA_FALSE;
 Eina_Bool script_override = EINA_FALSE;
 static Edje_Program *sequencing = NULL;
 static Eina_List *sequencing_lookups = NULL;
+static int *anonymous_delete = NULL;
 
 Eina_List *po_files;
 
@@ -5745,6 +5746,11 @@ _program_remove(const char *name, Edje_Program **pgrms, 
unsigned int count)
 
           _edje_program_remove(pc, pr);
 
+          if (pr->action == EDJE_ACTION_TYPE_SCRIPT)
+            {
+               anonymous_delete = &pr->id;
+            }
+
           _program_free(pr);
           return EINA_TRUE;
        }
@@ -5794,6 +5800,11 @@ st_collections_group_program_remove(void)
         success |= _program_remove(name, pc->programs.nocmp, 
pc->programs.nocmp_count);
 
         copied_program_lookup_delete(pc, name);
+        if (anonymous_delete)
+          {
+             copied_program_anonymous_lookup_delete(pc, anonymous_delete);
+             anonymous_delete = NULL;
+          }
         if (!success)
           {
              ERR("Attempted removal of nonexistent program '%s' in group 
'%s'.",
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index ee5fe14..03cf57e 100644
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -2943,6 +2943,20 @@ data_queue_anonymous_lookup(Edje_Part_Collection *pc, 
Edje_Program *ep, int *des
 }
 
 void
+copied_program_anonymous_lookup_delete(Edje_Part_Collection *pc, int *dest)
+{
+   Program_Lookup *pl;
+   Eina_List *l, *ll;
+
+   EINA_LIST_FOREACH_SAFE(program_lookups, l, ll, pl)
+     {
+        if ((!pl->anonymous) || (pl->pc != pc) || (dest != &pl->u.ep->id)) 
continue;
+        program_lookups = eina_list_remove_list(program_lookups, l);
+        free(pl);
+     }
+}
+
+void
 data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, int 
*dest)
 {
    Eina_List *l;

-- 


Reply via email to