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.
This commit is contained in:
Carsten Haitzler 2016-08-04 18:28:49 +09:00
parent c59995916e
commit e5cfb76ef1
1 changed files with 24 additions and 17 deletions

View File

@ -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))