tasn pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=93ade6f4ce4a336dfcdc748a09dd35003591978b

commit 93ade6f4ce4a336dfcdc748a09dd35003591978b
Author: Tom Hacohen <t...@stosb.com>
Date:   Fri Aug 21 17:19:47 2015 +0100

    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().
---
 src/lib/eo/eo_base_class.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index ff62cda..0c5f3ef 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)
         child = eina_list_data_get(pd->children);
         eo_do(child, eo_parent_set(NULL));
      }
-   // remove child from its parent on destruction - ha to be done
+
    if (pd->parent)
      {
-        Eo_Base_Data *parent_pd;
-
-        parent_pd = eo_data_scope_get(pd->parent, EO_BASE_CLASS);
-        parent_pd->children = eina_list_remove_list(parent_pd->children,
-                                                    pd->parent_list);
-        pd->parent_list = NULL;
+        /* If we have a parent still at the time of destruction, it means that
+         * ref was already (arguably erroneously unrefed) so we need to ref
+         * before it gets unrefed again. */
+        eo_ref(obj);
+        eo_do(obj, eo_parent_set(NULL));
      }
 
    _eo_generic_data_del_all(pd);

-- 


Reply via email to