Eo: Add an error if we get to a negative refcount.

SVN revision: 75505
This commit is contained in:
Tom Hacohen 2012-08-21 12:15:54 +00:00
parent 8a2c9acb0b
commit 7ac9e7cd4f
1 changed files with 7 additions and 1 deletions

View File

@ -1272,7 +1272,8 @@ _eo_free(Eo *obj)
static inline void
_eo_unref(Eo *obj)
{
if (--(obj->refcount) == 0)
--(obj->refcount);
if (obj->refcount == 0)
{
if (obj->del)
{
@ -1298,6 +1299,11 @@ _eo_unref(Eo *obj)
else
_eo_ref(obj); /* If we manual free, we keep a phantom ref. */
}
else if (obj->refcount < 0)
{
ERR("Obj:%p. Refcount (%d) < 0. Too many unrefs.", obj, obj->refcount);
return;
}
}
EAPI void