Eobj: Improved error reporting.
authortasn <tasn>
Thu, 12 Apr 2012 14:58:57 +0000 (14:58 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 12 Apr 2012 14:58:57 +0000 (14:58 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/PROTO/eobj@70148 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

lib/eobj.c

index ce83de3..d607cad 100644 (file)
@@ -16,6 +16,7 @@ static void _eobj_callback_remove_all(Eobj *obj);
 static void _eobj_generic_data_del_all(Eobj *obj);
 static void eobj_class_constructor(Eobj *obj, const Eobj_Class *klass);
 static void eobj_class_destructor(Eobj *obj, const Eobj_Class *klass);
+static void eobj_constructor_error_unset(Eobj *obj);
 
 #ifdef CRITICAL
 #undef CRITICAL
@@ -712,6 +713,7 @@ eobj_add(const Eobj_Class *klass, Eobj *parent)
    obj->data_blob = calloc(1, klass->data_offset + klass->desc->data_size);
 
    _eobj_kls_itr_init(obj, EOBJ_NOOP);
+   eobj_constructor_error_unset(obj);
    eobj_class_constructor(obj, klass);
    if (eobj_constructor_error_get(obj))
      {
@@ -747,6 +749,7 @@ eobj_unref(Eobj *obj)
      {
         const Eobj_Class *klass = eobj_class_get(obj);
         _eobj_kls_itr_init(obj, EOBJ_NOOP);
+        eobj_constructor_error_unset(obj);
         eobj_class_destructor(obj, klass);
         if (eobj_constructor_error_get(obj))
           {
@@ -763,6 +766,7 @@ eobj_unref(Eobj *obj)
         /* If for some reason it's not empty, clear it. */
         while (obj->kls_itr)
           {
+             WRN("Kls_Itr is not empty, possibly a bug, please report. - An error will be reported for each kls_itr in the stack.");
              Eina_Inlist *nitr = nitr->next;
              free(EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eobj_Kls_Itr_Node));
              obj->kls_itr = nitr;
@@ -772,6 +776,7 @@ eobj_unref(Eobj *obj)
         Eobj *emb_obj;
         EINA_LIST_FOREACH_SAFE(obj->composite_objects, itr, itr_n, emb_obj)
           {
+             /* FIXME: Should probably be unref. */
              eobj_del(emb_obj);
              obj->composite_objects =
                 eina_list_remove_list(obj->composite_objects, itr);
@@ -813,6 +818,12 @@ eobj_constructor_error_set(Eobj *obj)
    eobj_generic_data_set(obj, CONSTRUCT_ERROR_KEY, (void *) EINA_TRUE);
 }
 
+static void
+eobj_constructor_error_unset(Eobj *obj)
+{
+   eobj_generic_data_del(obj, CONSTRUCT_ERROR_KEY);
+}
+
 EAPI Eina_Bool
 eobj_constructor_error_get(const Eobj *obj)
 {