jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=289a4e3aaa26dead4d4374568b135ccd655dd897

commit 289a4e3aaa26dead4d4374568b135ccd655dd897
Author: Jean-Philippe Andre <[email protected]>
Date:   Fri Nov 10 17:18:12 2017 +0900

    cxx: Only give a single ref to unparented objects
    
    On instantiation objects get either one or two refs:
     - with a parent, they will have 2 refs, one for C++, one for the
       parent.
     - without a parent, they get a single ref, the one for C++
    
    This will break the existing C++ examples, which I will fix in later
    patches.
    
    Note that the window is a strange object which can be created with no
    parent but internally reparents itself to an object it creates (oh so
    ugly).
---
 src/bindings/cxx/eo_cxx/eo_cxx_interop.hh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh 
b/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh
index 72c435e4d7..662e5a7d55 100644
--- a/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh
+++ b/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh
@@ -846,8 +846,9 @@ inline void do_eo_add(Eo*& object, P const& parent
                       , Efl_Class const* klass
                       , typename std::enable_if< 
eo::is_eolian_object<P>::value>::type* = 0)
 {
-  object = ::_efl_add_internal_start(__FILE__, __LINE__, klass, 
parent._eo_ptr(), EINA_TRUE, EINA_FALSE);
-  object = ::_efl_add_end(object, EINA_TRUE, EINA_FALSE);
+  bool is_ref = (parent._eo_ptr() != nullptr);
+  object = ::_efl_add_internal_start(__FILE__, __LINE__, klass, 
parent._eo_ptr(), is_ref, EINA_FALSE);
+  object = ::_efl_add_end(object, is_ref, EINA_FALSE);
 }
 
 template <typename T>
@@ -871,9 +872,10 @@ void do_eo_add(Eo*& object, P const& parent, Efl_Class 
const* klass
                , F&& f
                , typename std::enable_if< 
eo::is_eolian_object<P>::value>::type* = 0)
 {
-  object = ::_efl_add_internal_start(__FILE__, __LINE__, klass, 
parent._eo_ptr(), EINA_TRUE, EINA_FALSE);
+  bool is_ref = (parent._eo_ptr() != nullptr);
+  object = ::_efl_add_internal_start(__FILE__, __LINE__, klass, 
parent._eo_ptr(), is_ref, EINA_FALSE);
   ::efl::eolian::call_lambda(std::forward<F>(f), proxy);
-  object = ::_efl_add_end(object, EINA_TRUE, EINA_FALSE);
+  object = ::_efl_add_end(object, is_ref, EINA_FALSE);
 }
 
 template <typename D, typename T>

-- 


Reply via email to