summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbdpngn <rbdpngn>2003-11-25 07:22:19 +0000
committerrbdpngn <rbdpngn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2003-11-25 07:22:19 +0000
commit6bee6d788d1089d2d3cbb75f42e16e69f240a947 (patch)
tree4187c369aba8c4cf8a33f480efcc9f67d2b4f6dc
parent6dd589c4c4aebaaf1a2c1794893ad033fd19eba4 (diff)
Avoid memory corruption by cleaning up parts at the correct time.
SVN revision: 7942
-rw-r--r--legacy/edje/src/lib/edje_load.c21
-rw-r--r--legacy/edje/src/lib/edje_private.h7
-rw-r--r--legacy/edje/src/lib/edje_text.c36
-rw-r--r--legacy/edje/src/lib/edje_util.c9
4 files changed, 48 insertions, 25 deletions
diff --git a/legacy/edje/src/lib/edje_load.c b/legacy/edje/src/lib/edje_load.c
index 0b36148..33bef23 100644
--- a/legacy/edje/src/lib/edje_load.c
+++ b/legacy/edje/src/lib/edje_load.c
@@ -432,7 +432,7 @@ _edje_file_del(Edje *ed)
432 if (ed->collection->references <= 0) 432 if (ed->collection->references <= 0)
433 { 433 {
434 ed->file->collection_hash = evas_hash_del(ed->file->collection_hash, ed->part, ed->collection); 434 ed->file->collection_hash = evas_hash_del(ed->file->collection_hash, ed->part, ed->collection);
435 _edje_collection_free(ed->collection); 435 _edje_collection_free(ed, ed->collection);
436 } 436 }
437 ed->collection = NULL; 437 ed->collection = NULL;
438 } 438 }
@@ -446,7 +446,7 @@ _edje_file_del(Edje *ed)
446 while (ed->parts) 446 while (ed->parts)
447 { 447 {
448 Edje_Real_Part *rp; 448 Edje_Real_Part *rp;
449 449
450 rp = ed->parts->data; 450 rp = ed->parts->data;
451 ed->parts = evas_list_remove(ed->parts, rp); 451 ed->parts = evas_list_remove(ed->parts, rp);
452 evas_object_event_callback_del(rp->object, 452 evas_object_event_callback_del(rp->object,
@@ -467,8 +467,7 @@ _edje_file_del(Edje *ed)
467 evas_object_event_callback_del(rp->object, 467 evas_object_event_callback_del(rp->object,
468 EVAS_CALLBACK_MOUSE_WHEEL, 468 EVAS_CALLBACK_MOUSE_WHEEL,
469 _edje_mouse_wheel_cb); 469 _edje_mouse_wheel_cb);
470 _edje_text_part_on_del(ed, rp); 470 _edje_text_real_part_on_del(ed, rp);
471 _edje_color_class_on_del(ed, rp);
472 evas_object_del(rp->object); 471 evas_object_del(rp->object);
473 if (rp->swallowed_object) 472 if (rp->swallowed_object)
474 { 473 {
@@ -554,12 +553,12 @@ _edje_file_free(Edje_File *edf)
554} 553}
555 554
556void 555void
557_edje_collection_free(Edje_Part_Collection *ec) 556_edje_collection_free(Edje *ed, Edje_Part_Collection *ec)
558{ 557{
559 while (ec->programs) 558 while (ec->programs)
560 { 559 {
561 Edje_Program *pr; 560 Edje_Program *pr;
562 561
563 pr = ec->programs->data; 562 pr = ec->programs->data;
564 ec->programs = evas_list_remove(ec->programs, pr); 563 ec->programs = evas_list_remove(ec->programs, pr);
565 if (pr->name) free(pr->name); 564 if (pr->name) free(pr->name);
@@ -580,11 +579,17 @@ _edje_collection_free(Edje_Part_Collection *ec)
580 while (ec->parts) 579 while (ec->parts)
581 { 580 {
582 Edje_Part *ep; 581 Edje_Part *ep;
583 582
584 ep = ec->parts->data; 583 ep = ec->parts->data;
585 ec->parts = evas_list_remove(ec->parts, ep); 584 ec->parts = evas_list_remove(ec->parts, ep);
585 _edje_text_part_on_del(ed, ep);
586 _edje_color_class_on_del(ed, ep);
586 if (ep->name) free(ep->name); 587 if (ep->name) free(ep->name);
587 if (ep->default_desc) _edje_collection_free_part_description_free(ep->default_desc); 588 if (ep->default_desc)
589 {
590 _edje_collection_free_part_description_free(ep->default_desc);
591 ep->default_desc = NULL;
592 }
588 while (ep->other_desc) 593 while (ep->other_desc)
589 { 594 {
590 Edje_Part_Description *desc; 595 Edje_Part_Description *desc;
diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h
index 848e7b4..714de4e 100644
--- a/legacy/edje/src/lib/edje_private.h
+++ b/legacy/edje/src/lib/edje_private.h
@@ -565,7 +565,7 @@ void _edje_edd_setup(void);
565void _edje_file_add(Edje *ed); 565void _edje_file_add(Edje *ed);
566void _edje_file_del(Edje *ed); 566void _edje_file_del(Edje *ed);
567void _edje_file_free(Edje_File *edf); 567void _edje_file_free(Edje_File *edf);
568void _edje_collection_free(Edje_Part_Collection *ec); 568void _edje_collection_free(Edje *ed, Edje_Part_Collection *ec);
569 569
570Edje *_edje_add(Evas_Object *obj); 570Edje *_edje_add(Evas_Object *obj);
571void _edje_del(Edje *ed); 571void _edje_del(Edje *ed);
@@ -581,14 +581,15 @@ void _edje_emit(Edje *ed, char *sig, char *src);
581void _edje_text_init(void); 581void _edje_text_init(void);
582void _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep); 582void _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep);
583void _edje_text_part_on_add_clippers(Edje *ed, Edje_Real_Part *ep); 583void _edje_text_part_on_add_clippers(Edje *ed, Edje_Real_Part *ep);
584void _edje_text_part_on_del(Edje *ed, Edje_Real_Part *ep); 584void _edje_text_part_on_del(Edje *ed, Edje_Part *ep);
585void _edje_text_real_part_on_del(Edje *ed, Edje_Real_Part *ep);
585void _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *params, Edje_Part_Description *chosen_desc); 586void _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *params, Edje_Part_Description *chosen_desc);
586 587
587Edje_Real_Part *_edje_real_part_get(Edje *ed, char *part); 588Edje_Real_Part *_edje_real_part_get(Edje *ed, char *part);
588Edje_Color_Class *_edje_color_class_find(Edje *ed, char *color_class); 589Edje_Color_Class *_edje_color_class_find(Edje *ed, char *color_class);
589void _edje_color_class_member_add(Edje *ed, char *color_class); 590void _edje_color_class_member_add(Edje *ed, char *color_class);
590void _edje_color_class_member_del(Edje *ed, char *color_class); 591void _edje_color_class_member_del(Edje *ed, char *color_class);
591void _edje_color_class_on_del(Edje *ed, Edje_Real_Part *rp); 592void _edje_color_class_on_del(Edje *ed, Edje_Part *ep);
592Edje_Text_Class *_edje_text_class_find(Edje *ed, char *text_class); 593Edje_Text_Class *_edje_text_class_find(Edje *ed, char *text_class);
593void _edje_text_class_member_add(Edje *ed, char *text_class); 594void _edje_text_class_member_add(Edje *ed, char *text_class);
594void _edje_text_class_member_del(Edje *ed, char *text_class); 595void _edje_text_class_member_del(Edje *ed, char *text_class);
diff --git a/legacy/edje/src/lib/edje_text.c b/legacy/edje/src/lib/edje_text.c
index 43acb54..903214f 100644
--- a/legacy/edje/src/lib/edje_text.c
+++ b/legacy/edje/src/lib/edje_text.c
@@ -229,27 +229,41 @@ _edje_text_part_on_add_clippers(Edje *ed, Edje_Real_Part *ep)
229} 229}
230 230
231void 231void
232_edje_text_part_on_del(Edje *ed, Edje_Real_Part *ep) 232_edje_text_part_on_del(Edje *ed, Edje_Part *pt)
233{ 233{
234 Evas_List *tmp; 234 Evas_List *tmp;
235 Edje_Part *pt = ep->part;
236 235
237 while (ep->extra_objects) 236 if ((pt->default_desc) && (pt->default_desc->text.text_class))
238 { 237 {
239 Evas_Object *o; 238 _edje_text_class_member_del(ed, pt->default_desc->text.text_class);
240 239 pt->default_desc->text.text_class = NULL;
241 o = ep->extra_objects->data;
242 ep->extra_objects = evas_list_remove(ep->extra_objects, o);
243 evas_object_del(o);
244 } 240 }
245
246 if ((pt->default_desc) && (pt->default_desc->text.text_class)) _edje_text_class_member_del(ed, pt->default_desc->text.text_class);
247 for (tmp = pt->other_desc; tmp; tmp = tmp->next) 241 for (tmp = pt->other_desc; tmp; tmp = tmp->next)
248 { 242 {
249 Edje_Part_Description *desc; 243 Edje_Part_Description *desc;
250 244
251 desc = tmp->data; 245 desc = tmp->data;
252 if (desc->text.text_class) _edje_text_class_member_del(ed, desc->text.text_class); 246 if (desc->text.text_class)
247 {
248 _edje_text_class_member_del(ed, desc->text.text_class);
249 desc->text.text_class = NULL;
250 }
251 }
252 return;
253}
254
255void
256_edje_text_real_part_on_del(Edje *ed, Edje_Real_Part *ep)
257{
258 Evas_List *tmp;
259
260 while (ep->extra_objects)
261 {
262 Evas_Object *o;
263
264 o = ep->extra_objects->data;
265 ep->extra_objects = evas_list_remove(ep->extra_objects, o);
266 evas_object_del(o);
253 } 267 }
254 return; 268 return;
255} 269}
diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c
index e45fc8d..042b851 100644
--- a/legacy/edje/src/lib/edje_util.c
+++ b/legacy/edje/src/lib/edje_util.c
@@ -1054,10 +1054,9 @@ _edje_color_class_member_del(Edje *ed, char *color_class)
1054} 1054}
1055 1055
1056void 1056void
1057_edje_color_class_on_del(Edje *ed, Edje_Real_Part *rp) 1057_edje_color_class_on_del(Edje *ed, Edje_Part *ep)
1058{ 1058{
1059 Evas_List *tmp; 1059 Evas_List *tmp;
1060 Edje_Part *ep = rp->part;
1061 1060
1062 if ((ep->default_desc) && (ep->default_desc->color_class)) _edje_color_class_member_del(ed, ep->default_desc->color_class); 1061 if ((ep->default_desc) && (ep->default_desc->color_class)) _edje_color_class_member_del(ed, ep->default_desc->color_class);
1063 for (tmp = ep->other_desc; tmp; tmp = tmp->next) 1062 for (tmp = ep->other_desc; tmp; tmp = tmp->next)
@@ -1065,7 +1064,11 @@ _edje_color_class_on_del(Edje *ed, Edje_Real_Part *rp)
1065 Edje_Part_Description *desc; 1064 Edje_Part_Description *desc;
1066 1065
1067 desc = tmp->data; 1066 desc = tmp->data;
1068 if (desc->color_class) _edje_color_class_member_del(ed, desc->color_class); 1067 if (desc->color_class)
1068 {
1069 _edje_color_class_member_del(ed, desc->color_class);
1070 desc->color_class = NULL;
1071 }
1069 } 1072 }
1070} 1073}
1071 1074