I installed 64bit Ubuntu in my computer.
I did build & install my patch. And I installed e and elementary.
But I could not find segment fault while build time.
So I checked it by using valgrind.
I changed some parts of my patch. But I cannot be sure it is right.
Please test that e and elementary is built well after installing my patch.
It works well in my computer. I don't know what is the problem.
Please test my patch.
Thanks.
--
Jaehwan Kim.
2011년 12월 20일 화요일에 Carsten Haitzler님이 작성:
> On Thu, 15 Dec 2011 11:05:47 +0900 Jaehwan Kim
> <[email protected]<javascript:;>>
> said:
>
> you still have bugs. try 64bit x86 so it actually crashes. i yet again get
> crashes on running edje_cc in my builds with your patch:
>
> ==29174== Conditional jump or move depends on uninitialised value(s)
> ==29174== at 0x40E0ED: mem_realloc (edje_cc_mem.c:34)
> ==29174== by 0x40E3DB: _edje_part_description_alloc
> (edje_cc_handlers.c:844)
> ==29174== by 0x413CED: ob_collections_group_parts_part_description
> (edje_cc_handlers.c:4152) ==29174== by 0x40A5DE: new_object
> (edje_cc_parse.c:137) ==29174== by 0x40B74D: parse (edje_cc_parse.c:555)
> ==29174== by 0x40C023: compile (edje_cc_parse.c:782)
> ==29174== by 0x404ABC: main (edje_cc.c:235)
> ==29174== Uninitialised value was created by a stack allocation
> ==29174== at 0x413C94: ob_collections_group_parts_part_description
> (edje_cc_handlers.c:4144)
>
> ==29174== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- n
> ==29174== Conditional jump or move depends on uninitialised value(s)
> ==29174== at 0x4C2901D: realloc (vg_replace_malloc.c:525)
> ==29174== by 0x40E118: mem_realloc (edje_cc_mem.c:37)
> ==29174== by 0x40E3DB: _edje_part_description_alloc
> (edje_cc_handlers.c:844)
> ==29174== by 0x413CED: ob_collections_group_parts_part_description
> (edje_cc_handlers.c:4152) ==29174== by 0x40A5DE: new_object
> (edje_cc_parse.c:137) ==29174== by 0x40B74D: parse (edje_cc_parse.c:555)
> ==29174== by 0x40C023: compile (edje_cc_parse.c:782)
> ==29174== by 0x404ABC: main (edje_cc.c:235)
> ==29174== Uninitialised value was created by a stack allocation
> ==29174== at 0x413C94: ob_collections_group_parts_part_description
> (edje_cc_handlers.c:4144)
>
> ==29174== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- n
> ==29174== Invalid free() / delete / delete[]
> ==29174== at 0x4C290A4: realloc (vg_replace_malloc.c:525)
> ==29174== by 0x40E118: mem_realloc (edje_cc_mem.c:37)
> ==29174== by 0x40E3DB: _edje_part_description_alloc
> (edje_cc_handlers.c:844)
> ==29174== by 0x413CED: ob_collections_group_parts_part_description
> (edje_cc_handlers.c:4152) ==29174== by 0x40A5DE: new_object
> (edje_cc_parse.c:137) ==29174== by 0x40B74D: parse (edje_cc_parse.c:555)
> ==29174== by 0x40C023: compile (edje_cc_parse.c:782)
> ==29174== by 0x404ABC: main (edje_cc.c:235)
> ==29174== Address 0x2905cda1bc is not stack'd, malloc'd or (recently)
> free'd
>
> these end up with a crash.
>
>
> > Dear Anyone concerned group inherit
> >
> > I changed the part of 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_**.
> >
> > Even if there is no problem currently, this change is necessary.
> > Please review my patch.
> > If it is proper, I will upload it in the svn.
> >
> > Thanks.
> > --
> > Jaehwan Kim.
>
>
> --
> ------------- Codito, ergo sum - "I code, therefore I am" --------------
> The Rasterman (Carsten Haitzler) [email protected] <javascript:;>
>
>
Index: src/bin/edje_cc_out.c
===================================================================
--- src/bin/edje_cc_out.c (리비전 66787)
+++ src/bin/edje_cc_out.c (작업 사본)
@@ -1387,25 +1387,25 @@ data_queue_group_lookup(const char *name, Edje_Par
void
data_queue_part_lookup(Edje_Part_Collection *pc, const char *name, int *dest)
{
- Eina_List *l;
+ Eina_List *l, *ln;
Part_Lookup *pl;
- EINA_LIST_FOREACH(part_lookups, l, pl)
+ EINA_LIST_FOREACH_SAFE(part_lookups, l, ln, pl)
{
if ((pl->pc == pc) && (pl->dest == dest))
{
free(pl->name);
- if (name[0])
+ if (name && name[0])
pl->name = mem_strdup(name);
else
{
- part_lookups = eina_list_remove(part_lookups, pl);
+ part_lookups = eina_list_remove_list(part_lookups, l);
free(pl);
}
return;
}
}
- if (!name[0]) return;
+ if (!name || !name[0]) return;
pl = mem_alloc(SZ(Part_Lookup));
part_lookups = eina_list_append(part_lookups, pl);
@@ -1430,12 +1430,12 @@ data_queue_copied_part_lookup(Edje_Part_Collection
void
data_queue_anonymous_lookup(Edje_Part_Collection *pc, Edje_Program *ep, int *dest)
{
- Eina_List *l, *l2;
+ Eina_List *l, *l2, *ln, *ln2;
Program_Lookup *pl;
if (!ep) return ; /* FIXME: should we stop compiling ? */
- EINA_LIST_FOREACH(program_lookups, l, pl)
+ EINA_LIST_FOREACH_SAFE(program_lookups, l, ln, pl)
{
if (pl->u.ep == ep)
{
@@ -1444,17 +1444,18 @@ data_queue_anonymous_lookup(Edje_Part_Collection *
cd = eina_list_data_get(eina_list_last(codes));
- EINA_LIST_FOREACH(cd->programs, l2, cp)
+ EINA_LIST_FOREACH_SAFE(cd->programs, l2, ln2, cp)
{
if (&(cp->id) == pl->dest)
{
- cd->programs = eina_list_remove(cd->programs, cp);
+ cd->programs = eina_list_remove_list(cd->programs, l2);
free(cp);
cp = NULL;
}
}
- program_lookups = eina_list_remove(program_lookups, pl);
+ program_lookups = eina_list_remove_list(program_lookups, l);
free(pl);
+ pl = NULL;
}
}
@@ -1540,8 +1541,27 @@ data_queue_copied_program_lookup(Edje_Part_Collect
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_list(image_lookups, l);
+ free(il);
+ il = NULL;
+ }
+ return;
+ }
+ }
+ if (!name || !name[0]) return;
+
il = mem_alloc(SZ(Image_Lookup));
image_lookups = eina_list_append(image_lookups, il);
il->name = mem_strdup(name);
Index: src/bin/edje_cc_mem.c
===================================================================
--- src/bin/edje_cc_mem.c (리비전 66787)
+++ src/bin/edje_cc_mem.c (작업 사본)
@@ -26,6 +26,22 @@ mem_alloc(size_t size)
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)
{
Index: src/bin/edje_cc_handlers.c
===================================================================
--- src/bin/edje_cc_handlers.c (리비전 66787)
+++ src/bin/edje_cc_handlers.c (작업 사본)
@@ -832,7 +832,7 @@ _edje_part_description_fill(Edje_Part_Description_
}
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;
@@ -841,14 +841,15 @@ static Edje_Part_Description_Common *
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;
@@ -866,7 +867,8 @@ static Edje_Part_Description_Common *
{
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;
@@ -879,7 +881,8 @@ static Edje_Part_Description_Common *
{
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;
@@ -892,7 +895,8 @@ static Edje_Part_Description_Common *
{
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;
@@ -908,7 +912,8 @@ static Edje_Part_Description_Common *
{
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);
@@ -923,7 +928,8 @@ static Edje_Part_Description_Common *
{
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;
@@ -942,6 +948,53 @@ static Edje_Part_Description_Common *
}
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;
@@ -2945,9 +2998,22 @@ st_collections_group_parts_part_name(void)
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,
@@ -2960,6 +3026,11 @@ st_collections_group_parts_part_type(void)
"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);
}
/**
@@ -4078,7 +4149,7 @@ ob_collections_group_parts_part_description(void)
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)
{
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel