tasn pushed a commit to branch master.

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

commit 40cb2cd3d44e3266b7a50a3c64626034da2817e4
Author: Tom Hacohen <t...@stosb.com>
Date:   Fri Jan 23 16:51:02 2015 +0000

    Eo add: beef up error reporting.
    
    In some cases object ceration would fail without an error,
    this is bad and should not happen.
    
    Thanks to cedric for reporting.
---
 src/lib/eo/eo.c                 |  5 ++++-
 src/lib/eo/eo_ptr_indirection.h | 24 ++++++++++++++++++++----
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 96f190d..a0adecd 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -933,7 +933,10 @@ _eo_add_internal_end(Eo *eo_id)
      }
 
    if (EINA_UNLIKELY(!fptr->o.obj))
-      return NULL;
+     {
+        ERR("Corrupt call stuck, shouldn't happen, please report!");
+        return NULL;
+     }
 
    if (!fptr->o.obj->condtor_done || fptr->o.obj->do_error)
      {
diff --git a/src/lib/eo/eo_ptr_indirection.h b/src/lib/eo/eo_ptr_indirection.h
index 9978701..c801e47 100644
--- a/src/lib/eo/eo_ptr_indirection.h
+++ b/src/lib/eo/eo_ptr_indirection.h
@@ -11,29 +11,45 @@
 #define EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, ret) \
    _Eo_Object *obj; \
    do { \
+        if (!obj_id) return ret; \
         obj = _eo_obj_pointer_get((Eo_Id)obj_id); \
-        if (!obj) return ret; \
+        if (!obj) { \
+             ERR("Obj (%p) is an invalid ref.", obj_id); \
+             return ret; \
+        } \
    } while (0)
 
 #define EO_OBJ_POINTER_RETURN(obj_id, obj)   \
    _Eo_Object *obj; \
    do { \
+        if (!obj_id) return; \
         obj = _eo_obj_pointer_get((Eo_Id)obj_id);   \
-        if (!obj) return; \
+        if (!obj) { \
+             ERR("Obj (%p) is an invalid ref.", obj_id); \
+             return; \
+        } \
    } while (0)
 
 #define EO_CLASS_POINTER_RETURN_VAL(klass_id, klass, ret) \
    _Eo_Class *klass; \
    do { \
+        if (!klass_id) return ret; \
         klass = _eo_class_pointer_get(klass_id); \
-        if (!klass) return ret; \
+        if (!klass) { \
+             ERR("Klass (%p) is an invalid ref.", klass_id); \
+             return ret; \
+        } \
    } while (0)
 
 #define EO_CLASS_POINTER_RETURN(klass_id, klass)   \
    _Eo_Class *klass; \
    do { \
+        if (!klass_id) return; \
         klass = _eo_class_pointer_get(klass_id); \
-        if (!klass) return; \
+        if (!klass) { \
+             ERR("Klass (%p) is an invalid ref.", klass_id); \
+             return; \
+        } \
    } while (0)
 
 #else

-- 


Reply via email to