summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-08-20 12:50:52 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-08-20 12:53:53 +0900
commit8689d54471aafdd7a5b5a27ce116bf2ab68c1042 (patch)
tree45ea81802e995f684c1b9273fc04461e3595efae
parent50e91e53219a31c967e1c702073c6f960b175c90 (diff)
eo - destruction - ensure child is removed from parent child list
this follows on from cbc1a217bfc8b5c6dd94f0448f19245c43eb05e0 as this code was correct, but was then causing bugs due to children staying in their parent lists. this should never have happened and this is really bad. this fixes this and ensures children on destruction are gone from their parent lists. @fix
-rw-r--r--src/lib/eo/eo_base_class.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index fe52203bac..9f8252b6bd 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -977,7 +977,6 @@ EOLIAN static void
977_eo_base_destructor(Eo *obj, Eo_Base_Data *pd) 977_eo_base_destructor(Eo *obj, Eo_Base_Data *pd)
978{ 978{
979 Eo *child; 979 Eo *child;
980 Eo_Base_Data *child_pd;
981 980
982 DBG("%p - %s.", obj, eo_class_name_get(MY_CLASS)); 981 DBG("%p - %s.", obj, eo_class_name_get(MY_CLASS));
983 982
@@ -987,11 +986,18 @@ _eo_base_destructor(Eo *obj, Eo_Base_Data *pd)
987 while (pd->children) 986 while (pd->children)
988 { 987 {
989 child = eina_list_data_get(pd->children); 988 child = eina_list_data_get(pd->children);
990 child_pd = eo_data_scope_get(child, EO_BASE_CLASS);
991 pd->children = eina_list_remove_list(pd->children, pd->children);
992 child_pd->parent_list = NULL;
993 eo_do(child, eo_parent_set(NULL)); 989 eo_do(child, eo_parent_set(NULL));
994 } 990 }
991 // remove child from its parent on destruction - ha to be done
992 if (pd->parent)
993 {
994 Eo_Base_Data *parent_pd;
995
996 parent_pd = eo_data_scope_get(pd->parent, EO_BASE_CLASS);
997 parent_pd->children = eina_list_remove_list(parent_pd->children,
998 pd->parent_list);
999 pd->parent_list = NULL;
1000 }
995 1001
996 _eo_generic_data_del_all(pd); 1002 _eo_generic_data_del_all(pd);
997 _wref_destruct(pd); 1003 _wref_destruct(pd);