aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-08-04 18:28:49 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-08-04 18:28:49 +0900
commite5cfb76ef1b23717356aeffbbbde7eafe5e3e1a0 (patch)
treeb86d2bdbb8ef7be04508ab8e00c69f6292ae6617
parentedje - fix access to freed data struct during object shutdown (diff)
downloadefl-e5cfb76ef1b23717356aeffbbbde7eafe5e3e1a0.tar.gz
edje object shutdown - be far more paranoid about ptrs and order
so we didnt set everything to null after being freed and object sae freed after some data. do the data frees after objects are deleted so callbacks cant access null data anyway. this makes this edje shutdown far more robust and safe. massive improvement in stability i hope.
-rw-r--r--src/lib/edje/edje_load.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index f3e1e77d1e..59be38a16c 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -1632,6 +1632,7 @@ _edje_file_del(Edje *ed)
#endif
rp = ed->table_parts[i];
+ if (!rp) continue;
#ifdef HAVE_EPHYSICS
EINA_LIST_FREE(rp->body_faces, face_obj)
@@ -1641,6 +1642,24 @@ _edje_file_del(Edje *ed)
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
_edje_entry_real_part_shutdown(ed, rp);
+ if (rp->object)
+ {
+ _edje_callbacks_focus_del(rp->object, ed);
+ _edje_callbacks_del(rp->object, ed);
+ evas_object_del(rp->object);
+ rp->object = NULL;
+ }
+
+ if (rp->custom)
+ {
+ // xxx: lua2
+ _edje_collection_free_part_description_clean(rp->part->type,
+ rp->custom->description,
+ ed->file->free_strings);
+ free(rp->custom->description);
+ rp->custom->description = NULL;
+ }
+
if ((rp->type == EDJE_RP_TYPE_CONTAINER) &&
(rp->typedata.container))
{
@@ -1695,30 +1714,16 @@ _edje_file_del(Edje *ed)
rp->typedata.swallow = NULL;
}
- if (rp->object)
- {
- _edje_callbacks_focus_del(rp->object, ed);
- _edje_callbacks_del(rp->object, ed);
- evas_object_del(rp->object);
- }
-
- if (rp->custom)
- {
- // xxx: lua2
- _edje_collection_free_part_description_clean(rp->part->type,
- rp->custom->description,
- ed->file->free_strings);
- free(rp->custom->description);
- rp->custom->description = NULL;
- }
-
/* Cleanup optional part. */
free(rp->drag);
+ rp->drag = NULL;
free(rp->param1.set);
+ rp->param1.set = NULL;
if (rp->param2)
{
free(rp->param2->set);
+ rp->param2->set = NULL;
eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->param2->p.map);
#ifdef HAVE_EPHYSICS
eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->param2->p.physics);
@@ -1729,6 +1734,7 @@ _edje_file_del(Edje *ed)
if (rp->custom)
{
free(rp->custom->set);
+ rp->custom->set = NULL;
eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->custom->p.map);
#ifdef HAVE_EPHYSICS
eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->custom->p.physics);
@@ -1751,6 +1757,7 @@ _edje_file_del(Edje *ed)
eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->param1.p.physics);
#endif
eina_mempool_free(_edje_real_part_mp, rp);
+ ed->table_parts[i] = NULL;
}
}
if ((ed->file) && (ed->collection))