edje_cc: correctly copy part descriptions when setting part type
authorMike Blumenkrantz <zmike@osg.samsung.com>
Wed, 16 Dec 2015 19:35:19 +0000 (14:35 -0500)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Wed, 16 Dec 2015 20:03:40 +0000 (15:03 -0500)
in the case where a part is inherited, changing the type will lead to
broken part/program lookups for the part during resolving in write-out;
memcpy alone is not enough to fix this.

@fix

src/bin/edje/edje_cc_handlers.c

index 3e2c5e3..1421062 100644 (file)
@@ -5076,8 +5076,13 @@ _part_type_set(unsigned int type)
         if (previous)
           {
              new = _edje_part_description_alloc(type, pc->part, ep->name);
-             memcpy(new, previous, sizeof (Edje_Part_Description_Common));
              eina_hash_add(desc_hash, &new, ep);
+             parent_desc = previous;
+             new->state.name = strdup(previous->state.name);
+             new->state.value = previous->state.value;
+             st_collections_group_parts_part_description_inherit();
+             parent_desc = NULL;
+             _part_desc_free(pc, ep, previous);
 
              ep->default_desc = new;
           }
@@ -5086,8 +5091,13 @@ _part_type_set(unsigned int type)
           {
              previous = ep->other.desc[i];
              new = _edje_part_description_alloc(type, pc->part, ep->name);
-             memcpy(new, previous, sizeof (Edje_Part_Description_Common));
              eina_hash_add(desc_hash, &new, ep);
+             parent_desc = previous;
+             new->state.name = strdup(previous->state.name);
+             new->state.value = previous->state.value;
+             st_collections_group_parts_part_description_inherit();
+             parent_desc = NULL;
+             _part_desc_free(pc, ep, previous);
              ep->other.desc[i] = new;
           }
      }