forked from enlightenment/efl
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:
parent
c9cd50983f
commit
9632a6ef4e
|
@ -1294,6 +1294,12 @@ _eo_unref(Eo *obj)
|
||||||
{
|
{
|
||||||
if (--(obj->refcount) == 0)
|
if (--(obj->refcount) == 0)
|
||||||
{
|
{
|
||||||
|
if (obj->del)
|
||||||
|
{
|
||||||
|
ERR("Object %p already deleted.", obj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_eo_del_internal(obj);
|
_eo_del_internal(obj);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
|
|
@ -181,6 +181,15 @@ START_TEST(eo_man_free)
|
||||||
eo_manual_free(obj);
|
eo_manual_free(obj);
|
||||||
eo_unref(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();
|
eo_shutdown();
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
Loading…
Reference in New Issue