From f122437dd6fe624e8c3932e39005cd2c172d8162 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sun, 5 Jun 2016 15:16:58 +0100 Subject: [PATCH] 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. --- src/lib/eo/eo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index 2797d1ae8d..6489d47459 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -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; } }