summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-08-21 17:19:47 +0100
committerTom Hacohen <tom@stosb.com>2015-08-21 17:23:13 +0100
commit93ade6f4ce4a336dfcdc748a09dd35003591978b (patch)
tree261225563b2c21d71d8f63ee300f58a7afefde58
parent7aea193a971a395b3afd09a6fa6f1b8985fc431a (diff)
Eo base: clean up parent removal in destructor.
This cleans up the changes in 8689d54471aafdd7a5b5a27ce116bf2ab68c1042. This commit reduces code duplication, and fixes broken handling of overridden parent_set().
-rw-r--r--src/lib/eo/eo_base_class.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index ff62cdae34..0c5f3ef01d 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -986,15 +986,14 @@ _eo_base_destructor(Eo *obj, Eo_Base_Data *pd)
986 child = eina_list_data_get(pd->children); 986 child = eina_list_data_get(pd->children);
987 eo_do(child, eo_parent_set(NULL)); 987 eo_do(child, eo_parent_set(NULL));
988 } 988 }
989 // remove child from its parent on destruction - ha to be done 989
990 if (pd->parent) 990 if (pd->parent)
991 { 991 {
992 Eo_Base_Data *parent_pd; 992 /* If we have a parent still at the time of destruction, it means that
993 993 * ref was already (arguably erroneously unrefed) so we need to ref
994 parent_pd = eo_data_scope_get(pd->parent, EO_BASE_CLASS); 994 * before it gets unrefed again. */
995 parent_pd->children = eina_list_remove_list(parent_pd->children, 995 eo_ref(obj);
996 pd->parent_list); 996 eo_do(obj, eo_parent_set(NULL));
997 pd->parent_list = NULL;
998 } 997 }
999 998
1000 _eo_generic_data_del_all(pd); 999 _eo_generic_data_del_all(pd);