Eo: Added a phantom ref if we manual free.
authorTom Hacohen <tom@stosb.com>
Wed, 6 Jun 2012 11:41:53 +0000 (11:41 +0000)
committerTom Hacohen <tom@stosb.com>
Wed, 6 Jun 2012 11:41:53 +0000 (11:41 +0000)
This lets us use eo_do and the such on deleted to be manually freed objects.

SVN revision: 71746

legacy/eobj/lib/eo.c

index c9ab366..1edd486 100644 (file)
@@ -1291,7 +1291,10 @@ _eo_unref(Eo *obj)
           }
 #endif
 
-        if (!obj->manual_free) _eo_free(obj);
+        if (!obj->manual_free)
+           _eo_free(obj);
+        else
+           _eo_ref(obj); /* If we manual free, we keep a phantom ref. */
      }
 }
 
@@ -1580,7 +1583,7 @@ eo_manual_free(Eo *obj)
         return;
      }
 
-   if (0 != obj->refcount)
+   if (!obj->del)
      {
         ERR("Tried deleting the object %p while still referenced(%d).", obj, eo_ref_get(obj));
         return;