summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-10 17:18:12 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-14 12:18:39 +0900
commit289a4e3aaa26dead4d4374568b135ccd655dd897 (patch)
tree185cf6ef82645b4a1c1f2f782f779feec791d20f /src
parent0c142462a1b928f88589612333c695f80cc09a51 (diff)
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).
Diffstat (limited to 'src')
-rw-r--r--src/bindings/cxx/eo_cxx/eo_cxx_interop.hh10
1 files 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
846 , Efl_Class const* klass 846 , Efl_Class const* klass
847 , typename std::enable_if< eo::is_eolian_object<P>::value>::type* = 0) 847 , typename std::enable_if< eo::is_eolian_object<P>::value>::type* = 0)
848{ 848{
849 object = ::_efl_add_internal_start(__FILE__, __LINE__, klass, parent._eo_ptr(), EINA_TRUE, EINA_FALSE); 849 bool is_ref = (parent._eo_ptr() != nullptr);
850 object = ::_efl_add_end(object, EINA_TRUE, EINA_FALSE); 850 object = ::_efl_add_internal_start(__FILE__, __LINE__, klass, parent._eo_ptr(), is_ref, EINA_FALSE);
851 object = ::_efl_add_end(object, is_ref, EINA_FALSE);
851} 852}
852 853
853template <typename T> 854template <typename T>
@@ -871,9 +872,10 @@ void do_eo_add(Eo*& object, P const& parent, Efl_Class const* klass
871 , F&& f 872 , F&& f
872 , typename std::enable_if< eo::is_eolian_object<P>::value>::type* = 0) 873 , typename std::enable_if< eo::is_eolian_object<P>::value>::type* = 0)
873{ 874{
874 object = ::_efl_add_internal_start(__FILE__, __LINE__, klass, parent._eo_ptr(), EINA_TRUE, EINA_FALSE); 875 bool is_ref = (parent._eo_ptr() != nullptr);
876 object = ::_efl_add_internal_start(__FILE__, __LINE__, klass, parent._eo_ptr(), is_ref, EINA_FALSE);
875 ::efl::eolian::call_lambda(std::forward<F>(f), proxy); 877 ::efl::eolian::call_lambda(std::forward<F>(f), proxy);
876 object = ::_efl_add_end(object, EINA_TRUE, EINA_FALSE); 878 object = ::_efl_add_end(object, is_ref, EINA_FALSE);
877} 879}
878 880
879template <typename D, typename T> 881template <typename D, typename T>