forked from enlightenment/efl
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).
This commit is contained in:
parent
0c142462a1
commit
289a4e3aaa
|
@ -846,8 +846,9 @@ inline void do_eo_add(Eo*& object, P const& parent
|
||||||
, Efl_Class const* klass
|
, Efl_Class const* klass
|
||||||
, typename std::enable_if< eo::is_eolian_object<P>::value>::type* = 0)
|
, 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_end(object, EINA_TRUE, EINA_FALSE);
|
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>
|
template <typename T>
|
||||||
|
@ -871,9 +872,10 @@ void do_eo_add(Eo*& object, P const& parent, Efl_Class const* klass
|
||||||
, F&& f
|
, F&& f
|
||||||
, typename std::enable_if< eo::is_eolian_object<P>::value>::type* = 0)
|
, 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);
|
::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>
|
template <typename D, typename T>
|
||||||
|
|
Loading…
Reference in New Issue