Eo: fix reference hack when calling composite objects.

We used to keep a reference to the parent object and have it in the call
structure although we were actually calling the function on the embedded
object. This was needed because we wanted to unref the parent correctly.
This was incorrect (and marked as a hack) and now I finally gotten
around to implementing the (amazingly simple) fix to remove this
workaround.

Essentially we just ref the comp object, unref the parent, and let the
normal eo call flow to unref the comp object correctly later on, like it
would have unreffed the extra ref we had for the parent.
This commit is contained in:
Tom Hacohen 2016-06-05 15:16:58 +01:00
parent 5eff3ee9dd
commit f122437dd6
1 changed files with 4 additions and 1 deletions

View File

@ -437,10 +437,13 @@ end:
if (EINA_LIKELY(func->func && func->src))
{
call->eo_id = _eo_obj_id_get(emb_obj);
call->obj = obj; /* FIXME-eo4: Hack, we retain the previous object so we unref it... */
call->obj = _eo_ref(emb_obj);
call->func = func->func;
call->data = _eo_data_scope_get(emb_obj, func->src);
/* We reffed it above, but no longer need/use it. */
_eo_unref(obj);
return EINA_TRUE;
}
}