discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=11da9421842c439474ea08b346cdb1ee986db361

commit 11da9421842c439474ea08b346cdb1ee986db361
Author: Mike Blumenkrantz <[email protected]>
Date:   Thu Oct 9 21:01:48 2014 -0400

    Revert "Eo: Move eo_add_ref logic inside the library."
    
    This reverts commit 8d16d8eb5711d246509e44bf0ce5366f65fd9aea.
    
    this broke child object deletion in all the cases that I tested and regular 
object deletion in some cases as well
---
 src/lib/eo/Eo.h | 15 +++++----------
 src/lib/eo/eo.c |  4 ++--
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 8c26d6e..b280797 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -636,7 +636,7 @@ EAPI void eo_error_set_internal(const Eo *obj, const char 
*file, int line);
 #define eo_add(klass, parent, ...) \
    ({ \
     const Eo_Class *_tmp_klass = klass; \
-    Eo *_tmp_obj = _eo_add_internal_start(__FILE__, __LINE__, _tmp_klass, 
parent, EINA_FALSE); \
+    Eo *_tmp_obj = _eo_add_internal_start(__FILE__, __LINE__, _tmp_klass, 
parent); \
     eo_do(_tmp_obj, \
            eo_constructor(); \
            __VA_ARGS__; \
@@ -659,17 +659,12 @@ EAPI void eo_error_set_internal(const Eo *obj, const char 
*file, int line);
  */
 #define eo_add_ref(klass, parent, ...) \
    ({ \
-    const Eo_Class *_tmp_klass = klass; \
-    Eo *_tmp_obj = _eo_add_internal_start(__FILE__, __LINE__, _tmp_klass, 
parent, EINA_TRUE); \
-    eo_do(_tmp_obj, \
-           eo_constructor(); \
-           __VA_ARGS__; \
-           _tmp_obj = eo_finalize(); \
-          ); \
-    _tmp_obj; \
+    Eo *_tmp_obj_ref = eo_add(klass, parent, __VA_ARGS__); \
+    if (eo_do(_tmp_obj_ref, eo_parent_get())) eo_ref(_tmp_obj_ref); \
+    _tmp_obj_ref; \
     })
 
-EAPI Eo * _eo_add_internal_start(const char *file, int line, const Eo_Class 
*klass_id, Eo *parent, Eina_Bool ref);
+EAPI Eo * _eo_add_internal_start(const char *file, int line, const Eo_Class 
*klass_id, Eo *parent);
 
 /**
  * @brief Get a pointer to the data of an object for a specific class.
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 6e3ed73..e78b6f0 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -868,7 +868,7 @@ _eo_class_funcs_set(_Eo_Class *klass)
 }
 
 EAPI Eo *
-_eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, 
Eo *parent_id, Eina_Bool ref)
+_eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, 
Eo *parent_id)
 {
    _Eo_Object *obj;
 
@@ -915,7 +915,7 @@ _eo_add_internal_start(const char *file, int line, const 
Eo_Class *klass_id, Eo
 
    /* If there's a parent. Unref. Eo_add should return an object with either a
     * parent ref, or with the lack of, just a ref. */
-   if (!ref && eo_do(eo_id, eo_parent_get()))
+   if (eo_do(eo_id, eo_parent_get()))
      {
         _eo_unref(obj);
      }

-- 


Reply via email to