cxx: Add global _delete() method to all objects

This is really just calling efl_del() and detaching the internal pointer
from the C++ object. This will not affect other references, which means
after del the object may still be alive, probably without a parent.
This commit is contained in:
Jean-Philippe Andre 2017-11-28 16:26:25 +09:00
parent 09cf282741
commit c9322dd561
2 changed files with 13 additions and 0 deletions

View File

@ -167,6 +167,13 @@ struct concrete
_eo_raw = _ptr;
}
void _delete()
{
Eo* tmp = _eo_raw;
_eo_raw = nullptr;
detail::del(tmp);
}
explicit operator bool() const
{
return _eo_raw;

View File

@ -39,6 +39,12 @@ unref(const Eo *obj)
::efl_unref(obj);
}
inline void
del(Eo *obj)
{
::efl_del(obj);
}
inline int
ref_get(const Eo *obj)
{