Eo: Added a check if object is already deleted in eo_unref.

If an object is manually freed it was possible to ref/unref it so it'll
try to call the destructor again.

SVN revision: 71890
This commit is contained in:
Tom Hacohen 2012-06-10 07:53:43 +00:00
parent c9cd50983f
commit 9632a6ef4e
2 changed files with 15 additions and 0 deletions

View File

@ -1294,6 +1294,12 @@ _eo_unref(Eo *obj)
{
if (--(obj->refcount) == 0)
{
if (obj->del)
{
ERR("Object %p already deleted.", obj);
return;
}
_eo_del_internal(obj);
#ifndef NDEBUG

View File

@ -181,6 +181,15 @@ START_TEST(eo_man_free)
eo_manual_free(obj);
eo_unref(obj);
obj = eo_add(klass, NULL);
fail_if(!obj);
eo_manual_free_set(obj, EINA_TRUE);
eo_unref(obj);
eo_ref(obj);
eo_unref(obj);
eo_unref(obj);
eo_manual_free(obj);
eo_shutdown();
}
END_TEST