cxx: Add global _delete() method to all objects
authorJean-Philippe Andre <jp.andre@samsung.com>
Tue, 28 Nov 2017 07:26:25 +0000 (16:26 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 5 Dec 2017 06:01:45 +0000 (15:01 +0900)
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.

src/bindings/cxx/eo_cxx/eo_concrete.hh
src/bindings/cxx/eo_cxx/eo_ops.hh

index 47013dc..2b29d09 100644 (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;
index 1f08d8d..4f9c1f7 100644 (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)
 {