On Fri, Aug 21, 2015 at 6:23 PM, Tom Hacohen <t...@stosb.com> wrote:
> 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().

Seriously that look as much hacky as the previous one. The issue is
still here. Why does eo_del remove the parent, but not eo_unref ? What
is the semantic of eo_del in fact here ? Reading the code, it just
means detach from parent and unref. While unref means unref without
unlinking... which could result in dead reference.

If eo_unref was removing the parent properly at the right time all the
patch that went in that part of eo could just be removed in my
opinion.

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



-- 
Cedric BAIL

------------------------------------------------------------------------------
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to