On Thu, 15 Dec 2011 01:15:12 -0800 "Enlightenment SVN"
<no-re...@enlightenment.org> said:

i've backed this out as this makes things worse... like stopping compiling from
being possible. see my commit log.

> Log:
> Bug fix - about type change in group inherit.
>   Lately, raster removed the code about the prohibition of type-change in
>   group inherit.
>   But about the "part" of different type, the data structure of the their
>   "description" is different.
>   So if the type is changed, it have to be reallocated. Current, it is not.
>   
>   At first, we have to remove the lookups. If we don't, when lookup module
>   executes, the memory
>   may be broken. So I removed all lookups for reallocated description before
>   it is reallocated.
>   And I changed all description of the "part" is reallocated when the type is
>   changed.
>   The attribute of the "part" is remained. Just it reallocated the part of
>   **_Spec_**.
>   
> 
> Author:       jaehwan
> Date:         2011-12-15 01:15:11 -0800 (Thu, 15 Dec 2011)
> New Revision: 66242
> Trac:         http://trac.enlightenment.org/e/changeset/66242
> 
> Modified:
>   trunk/edje/src/bin/edje_cc_handlers.c trunk/edje/src/bin/edje_cc_mem.c
> trunk/edje/src/bin/edje_cc_out.c 
> 
> Modified: trunk/edje/src/bin/edje_cc_handlers.c
> ===================================================================
> --- trunk/edje/src/bin/edje_cc_handlers.c     2011-12-15 09:12:14 UTC (rev
> 66241) +++ trunk/edje/src/bin/edje_cc_handlers.c      2011-12-15 09:15:11
> UTC (rev 66242) @@ -831,7 +831,7 @@
>  }
>  
>  static Edje_Part_Description_Common *
> -_edje_part_description_alloc(unsigned char type, const char *collection,
> const char *part) +_edje_part_description_alloc(Edje_Part_Description_Common
> *ced, unsigned char type, const char *collection, const char *part) {
>     Edje_Part_Description_Common *result = NULL;
>  
> @@ -840,14 +840,15 @@
>        case EDJE_PART_TYPE_RECTANGLE:
>        case EDJE_PART_TYPE_SWALLOW:
>        case EDJE_PART_TYPE_GROUP:
> -      result = mem_alloc(SZ(Edje_Part_Description_Common));
> +      result = mem_realloc(ced, SZ(Edje_Part_Description_Common));
>        break;
>        case EDJE_PART_TYPE_TEXT:
>        case EDJE_PART_TYPE_TEXTBLOCK:
>       {
>          Edje_Part_Description_Text *ed;
>  
> -        ed = mem_alloc(SZ(Edje_Part_Description_Text));
> +           ed = mem_realloc(ced, SZ(Edje_Part_Description_Text));
> +           memset(&(ed->text), 0, SZ(Edje_Part_Description_Spec_Text));
>  
>          ed->text.color3.r = 0;
>          ed->text.color3.g = 0;
> @@ -865,7 +866,8 @@
>       {
>          Edje_Part_Description_Image *ed;
>  
> -        ed = mem_alloc(SZ(Edje_Part_Description_Image));
> +           ed = mem_realloc(ced, SZ(Edje_Part_Description_Image));
> +           memset(&(ed->image), 0, SZ(Edje_Part_Description_Spec_Image));
>  
>          ed->image.id = -1;
>  
> @@ -878,7 +880,8 @@
>          {
>             Edje_Part_Description_Proxy *ed;
>  
> -           ed = mem_alloc(SZ(Edje_Part_Description_Proxy));
> +           ed = mem_realloc(ced, SZ(Edje_Part_Description_Proxy));
> +           memset(&(ed->proxy), 0, SZ(Edje_Part_Description_Spec_Proxy));
>  
>             ed->proxy.id = -1;
>  
> @@ -891,7 +894,8 @@
>       {
>          Edje_Part_Description_Box *ed;
>  
> -        ed = mem_alloc(SZ(Edje_Part_Description_Box));
> +           ed = mem_realloc(ced, SZ(Edje_Part_Description_Box));
> +           memset(&(ed->box), 0, SZ(Edje_Part_Description_Spec_Box));
>  
>          ed->box.layout = NULL;
>          ed->box.alt_layout = NULL;
> @@ -907,7 +911,8 @@
>       {
>          Edje_Part_Description_Table *ed;
>  
> -        ed = mem_alloc(SZ(Edje_Part_Description_Table));
> +           ed = mem_realloc(ced, SZ(Edje_Part_Description_Table));
> +           memset(&(ed->table), 0, SZ(Edje_Part_Description_Spec_Table));
>  
>          ed->table.homogeneous = EDJE_OBJECT_TABLE_HOMOGENEOUS_NONE;
>          ed->table.align.x = FROM_DOUBLE(0.5);
> @@ -922,7 +927,8 @@
>       {
>          Edje_Part_Description_External *ed;
>  
> -        ed = mem_alloc(SZ(Edje_Part_Description_External));
> +           ed = mem_realloc(ced, SZ(Edje_Part_Description_External));
> +           ed->external_params = NULL;
>  
>          ed->external_params = NULL;
>  
> @@ -941,6 +947,53 @@
>  }
>  
>  static void
> +_edje_part_description_lookup_del(Edje_Part_Collection *pc,
> Edje_Part_Description_Common *ced, unsigned char type) +{
> +   switch (type)
> +     {
> +      case EDJE_PART_TYPE_RECTANGLE:
> +      case EDJE_PART_TYPE_SWALLOW:
> +      case EDJE_PART_TYPE_GROUP:
> +         break;
> +      case EDJE_PART_TYPE_TEXT:
> +      case EDJE_PART_TYPE_TEXTBLOCK:
> +        {
> +           Edje_Part_Description_Text *ed = (Edje_Part_Description_Text*)ced;
> +
> +           data_queue_part_lookup(pc, NULL, &(ed->text.id_source));
> +           data_queue_part_lookup(pc, NULL, &(ed->text.id_text_source));
> +           break;
> +        }
> +      case EDJE_PART_TYPE_IMAGE:
> +        {
> +           int i;
> +           Edje_Part_Description_Image *ed =
> (Edje_Part_Description_Image*)ced;
> +           Edje_Part_Image_Id *iid;
> +
> +           data_queue_image_lookup(NULL, &(ed->image.id), NULL);
> +
> +           for (i = 0; i < ed->image.tweens_count; i++)
> +             {
> +                iid = ed->image.tweens[i];
> +                data_queue_image_lookup(NULL, &(iid->id), NULL);
> +             }
> +           break;
> +        }
> +      case EDJE_PART_TYPE_PROXY:
> +        {
> +           Edje_Part_Description_Proxy *ed =
> (Edje_Part_Description_Proxy*)ced; +
> +           data_queue_part_lookup(pc, NULL, &(ed->proxy.id));
> +           break;
> +        }
> +      case EDJE_PART_TYPE_BOX:
> +      case EDJE_PART_TYPE_TABLE:
> +      case EDJE_PART_TYPE_EXTERNAL:
> +         break;
> +     }
> +}
> +
> +static void
>  _edje_program_check(const char *name, Edje_Program *me, Edje_Program
> **pgrms, unsigned int count) {
>     Edje_Part_Collection *pc;
> @@ -2944,9 +2997,22 @@
>  static void
>  st_collections_group_parts_part_type(void)
>  {
> +   Edje_Part_Collection *pc;
> +   Edje_Part *ep;
> +   int i;
> +
>     check_arg_count(1);
>  
> -   current_part->type = parse_enum(0,
> +   pc = eina_list_data_get(eina_list_last(edje_collections));
> +   ep = current_part;
> +
> +   if (ep->default_desc)
> +     _edje_part_description_lookup_del(pc, ep->default_desc, ep->type);
> +
> +   for (i = 0; i < ep->other.desc_count; i++)
> +     _edje_part_description_lookup_del(pc, ep->other.desc[i], ep->type);
> +
> +   ep->type = parse_enum(0,
>                                     "NONE", EDJE_PART_TYPE_NONE,
>                                     "RECT", EDJE_PART_TYPE_RECTANGLE,
>                                     "TEXT", EDJE_PART_TYPE_TEXT,
> @@ -2959,6 +3025,11 @@
>                                     "EXTERNAL", EDJE_PART_TYPE_EXTERNAL,
>                                     "PROXY", EDJE_PART_TYPE_PROXY,
>                                     NULL);
> +   if (ep->default_desc)
> +     ep->default_desc = _edje_part_description_alloc(ep->default_desc,
> ep->type, pc->part, ep->name); +
> +   for (i = 0; i < ep->other.desc_count; i++)
> +     ep->other.desc[i] = _edje_part_description_alloc(ep->other.desc[i],
> ep->type, pc->part, ep->name); }
>  
>  /**
> @@ -4070,7 +4141,7 @@
>     pc = eina_list_data_get(eina_list_last(edje_collections));
>     ep = current_part;
>  
> -   ed = _edje_part_description_alloc(ep->type, pc->part, ep->name);
> +   ed = _edje_part_description_alloc(ed, ep->type, pc->part, ep->name);
>  
>     if (!ep->default_desc)
>       {
> 
> Modified: trunk/edje/src/bin/edje_cc_mem.c
> ===================================================================
> --- trunk/edje/src/bin/edje_cc_mem.c  2011-12-15 09:12:14 UTC (rev
> 66241) +++ trunk/edje/src/bin/edje_cc_mem.c   2011-12-15 09:15:11 UTC
> (rev 66242) @@ -26,6 +26,22 @@
>     return NULL;
>  }
>  
> +void *
> +mem_realloc(void *p, size_t size)
> +{
> +   void *mem;
> +
> +   if (!p)
> +     mem = calloc(1, size);
> +   else
> +     mem = realloc(p, size);
> +   if (mem) return mem;
> +   ERR("%s: Error. %s:%i memory allocation of " FMT_SIZE_T " bytes failed. %
> s",
> +       progname, file_in, line, size, strerror(errno));
> +   exit(-1);
> +   return NULL;
> +}
> +
>  char *
>  mem_strdup(const char *s)
>  {
> 
> Modified: trunk/edje/src/bin/edje_cc_out.c
> ===================================================================
> --- trunk/edje/src/bin/edje_cc_out.c  2011-12-15 09:12:14 UTC (rev
> 66241) +++ trunk/edje/src/bin/edje_cc_out.c   2011-12-15 09:15:11 UTC
> (rev 66242) @@ -1391,7 +1391,7 @@
>          if ((pl->pc == pc) && (pl->dest == dest))
>            {
>               free(pl->name);
> -             if (name[0])
> +             if (name && name[0])
>                 pl->name = mem_strdup(name);
>               else
>                 {
> @@ -1401,7 +1401,7 @@
>               return;
>            }
>       }
> -   if (!name[0]) return;
> +   if (!name || !name[0]) return;
>  
>     pl = mem_alloc(SZ(Part_Lookup));
>     part_lookups = eina_list_append(part_lookups, pl);
> @@ -1536,8 +1536,25 @@
>  void
>  data_queue_image_lookup(char *name, int *dest, Eina_Bool *set)
>  {
> +   Eina_List *l;
>     Image_Lookup *il;
>  
> +   EINA_LIST_FOREACH(image_lookups, l, il)
> +     {
> +        if (il->dest == dest)
> +          {
> +             free(il->name);
> +             if (name && name[0])
> +               il->name = mem_strdup(name);
> +             else
> +               {
> +                  image_lookups = eina_list_remove(image_lookups, il);
> +                  free(il);
> +               }
> +          }
> +     }
> +   if (!name || !name[0]) return;
> +
>     il = mem_alloc(SZ(Image_Lookup));
>     image_lookups = eina_list_append(image_lookups, il);
>     il->name = mem_strdup(name);
> 
> 
> ------------------------------------------------------------------------------
> 10 Tips for Better Server Consolidation
> Server virtualization is being driven by many needs.  
> But none more important than the need to reduce IT complexity 
> while improving strategic productivity.  Learn More! 
> http://www.accelacomm.com/jaw/sdnl/114/51507609/
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    ras...@rasterman.com


------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to