tasn pushed a commit to branch master.

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

commit c02bab4149b2f3984d0f7a0637003d2bcd62fabd
Author: Tom Hacohen <t...@stosb.com>
Date:   Wed May 20 16:48:20 2015 +0100

    Eo: Better handle object cleanup on failure.
    
    While unrefing twice works, it's cleaner to unref the ref we
    have and delete normally. It will handle parnet detachments in
    a nicer way, and is just more correct.
---
 src/lib/eo/eo.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index dffdcdb..766b7d3 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -926,9 +926,8 @@ _eo_add_internal_start(const char *file, int line, const 
Eo_Class *klass_id, Eo
      {
         ERR("Object of class '%s' - Error while constructing object",
             klass->desc->name);
-        /* Unref twice, once for the ref in _eo_add_internal_start, and once 
for the basic object ref. */
-        _eo_unref(obj);
         _eo_unref(obj);
+        eo_del((Eo *) obj->header.id);
         return NULL;
      }
 
@@ -981,9 +980,8 @@ _eo_add_internal_end(Eo *eo_id)
    return (Eo *)eo_id;
 
 cleanup:
-   /* Unref twice, once for the ref in _eo_add_internal_start, and once for 
the basic object ref. */
-   _eo_unref(fptr->o.obj);
    _eo_unref(fptr->o.obj);
+   eo_del((Eo *) fptr->o.obj->header.id);
    return NULL;
 }
 

-- 


Reply via email to