From: Jean-Philippe Andre Date: Tue, 28 Nov 2017 07:26:25 +0000 (+0900) Subject: cxx: Add global _delete() method to all objects X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~1350 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9322dd56104e6ee23c6840fbb5a202c3218c1e1;p=platform%2Fupstream%2Fefl.git 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. --- diff --git a/src/bindings/cxx/eo_cxx/eo_concrete.hh b/src/bindings/cxx/eo_cxx/eo_concrete.hh index 47013dc..2b29d09 100644 --- a/src/bindings/cxx/eo_cxx/eo_concrete.hh +++ b/src/bindings/cxx/eo_cxx/eo_concrete.hh @@ -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; diff --git a/src/bindings/cxx/eo_cxx/eo_ops.hh b/src/bindings/cxx/eo_cxx/eo_ops.hh index 1f08d8d..4f9c1f7 100644 --- a/src/bindings/cxx/eo_cxx/eo_ops.hh +++ b/src/bindings/cxx/eo_cxx/eo_ops.hh @@ -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) {