cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=79e4947f3e197f7d1c8336057cf54d6ddef482bc

commit 79e4947f3e197f7d1c8336057cf54d6ddef482bc
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Thu May 3 11:36:28 2018 -0700

    eo: add an automatic fallback at the moment when efl_unref instead of 
efl_del is called.
    
    Differential Revision: https://phab.enlightenment.org/D6095
---
 src/lib/eo/eo.c            | 9 +++++++++
 src/lib/eo/eo_base_class.c | 4 ++++
 src/lib/eo/eo_private.h    | 1 +
 3 files changed, 14 insertions(+)

diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index d034c70b23..a6323d1825 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -1882,6 +1882,15 @@ efl_unref(const Eo *obj_id)
 {
    EO_OBJ_POINTER_RETURN(obj_id, obj);
 
+   if (EINA_UNLIKELY(obj->user_refcount == 1 &&
+                     obj->parent))
+     {
+        CRI("Calling efl_unref instead of efl_del or efl_parent_set(NULL). 
Temporary fallback in place triggered.");
+        EO_OBJ_DONE(obj_id);
+        efl_del(obj_id);
+        return ;
+     }
+
    if (EINA_UNLIKELY(obj->user_refcount == 1))
      {
         // The noref event should happen before any object in the
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 94ed3d41f5..72aa678616 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -740,12 +740,16 @@ _efl_object_parent_set(Eo *obj, Efl_Object_Data *pd, Eo 
*parent_id)
              // to improve l1 cache efficiency
              goto err_parent;
           }
+
+        eo_obj->parent = EINA_TRUE;
      }
    else
      {
         if (prev_parent) _efl_invalidate(eo_obj);
 
         pd->parent = NULL;
+        eo_obj->parent = EINA_FALSE;
+
         if (prev_parent && !eo_obj->del_triggered) efl_unref(obj);
      }
 
diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h
index 77ef5e40f8..94882ef290 100644
--- a/src/lib/eo/eo_private.h
+++ b/src/lib/eo/eo_private.h
@@ -117,6 +117,7 @@ struct _Eo_Object
      Eina_Bool super:1;
      Eina_Bool invalidate:1;
      Eina_Bool is_invalidating:1;
+     Eina_Bool parent : 1;
 
      Eina_Bool del_triggered:1;
      Eina_Bool destructed:1;

-- 


Reply via email to