summaryrefslogtreecommitdiff
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
parentc59995916e9d240c816ac96242a4cd5106736eb2 (diff)
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)
1632#endif 1632#endif
1633 1633
1634 rp = ed->table_parts[i]; 1634 rp = ed->table_parts[i];
1635 if (!rp) continue;
1635 1636
1636#ifdef HAVE_EPHYSICS 1637#ifdef HAVE_EPHYSICS
1637 EINA_LIST_FREE(rp->body_faces, face_obj) 1638 EINA_LIST_FREE(rp->body_faces, face_obj)
@@ -1641,6 +1642,24 @@ _edje_file_del(Edje *ed)
1641 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) 1642 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1642 _edje_entry_real_part_shutdown(ed, rp); 1643 _edje_entry_real_part_shutdown(ed, rp);
1643 1644
1645 if (rp->object)
1646 {
1647 _edje_callbacks_focus_del(rp->object, ed);
1648 _edje_callbacks_del(rp->object, ed);
1649 evas_object_del(rp->object);
1650 rp->object = NULL;
1651 }
1652
1653 if (rp->custom)
1654 {
1655 // xxx: lua2
1656 _edje_collection_free_part_description_clean(rp->part->type,
1657 rp->custom->description,
1658 ed->file->free_strings);
1659 free(rp->custom->description);
1660 rp->custom->description = NULL;
1661 }
1662
1644 if ((rp->type == EDJE_RP_TYPE_CONTAINER) && 1663 if ((rp->type == EDJE_RP_TYPE_CONTAINER) &&
1645 (rp->typedata.container)) 1664 (rp->typedata.container))
1646 { 1665 {
@@ -1695,30 +1714,16 @@ _edje_file_del(Edje *ed)
1695 rp->typedata.swallow = NULL; 1714 rp->typedata.swallow = NULL;
1696 } 1715 }
1697 1716
1698 if (rp->object)
1699 {
1700 _edje_callbacks_focus_del(rp->object, ed);
1701 _edje_callbacks_del(rp->object, ed);
1702 evas_object_del(rp->object);
1703 }
1704
1705 if (rp->custom)
1706 {
1707 // xxx: lua2
1708 _edje_collection_free_part_description_clean(rp->part->type,
1709 rp->custom->description,
1710 ed->file->free_strings);
1711 free(rp->custom->description);
1712 rp->custom->description = NULL;
1713 }
1714
1715 /* Cleanup optional part. */ 1717 /* Cleanup optional part. */
1716 free(rp->drag); 1718 free(rp->drag);
1719 rp->drag = NULL;
1717 free(rp->param1.set); 1720 free(rp->param1.set);
1721 rp->param1.set = NULL;
1718 1722
1719 if (rp->param2) 1723 if (rp->param2)
1720 { 1724 {
1721 free(rp->param2->set); 1725 free(rp->param2->set);
1726 rp->param2->set = NULL;
1722 eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->param2->p.map); 1727 eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->param2->p.map);
1723#ifdef HAVE_EPHYSICS 1728#ifdef HAVE_EPHYSICS
1724 eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->param2->p.physics); 1729 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)
1729 if (rp->custom) 1734 if (rp->custom)
1730 { 1735 {
1731 free(rp->custom->set); 1736 free(rp->custom->set);
1737 rp->custom->set = NULL;
1732 eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->custom->p.map); 1738 eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->custom->p.map);
1733#ifdef HAVE_EPHYSICS 1739#ifdef HAVE_EPHYSICS
1734 eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->custom->p.physics); 1740 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)
1751 eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->param1.p.physics); 1757 eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->param1.p.physics);
1752#endif 1758#endif
1753 eina_mempool_free(_edje_real_part_mp, rp); 1759 eina_mempool_free(_edje_real_part_mp, rp);
1760 ed->table_parts[i] = NULL;
1754 } 1761 }
1755 } 1762 }
1756 if ((ed->file) && (ed->collection)) 1763 if ((ed->file) && (ed->collection))