Eobj: Make eobj_weak_ref_add return the obejct being reffed.

Suggested by vtorri.

SVN revision: 70418
This commit is contained in:
Tom Hacohen 2012-04-23 12:32:36 +00:00
parent 5b529c506b
commit 31e6682a66
2 changed files with 6 additions and 3 deletions

View File

@ -545,8 +545,9 @@ EAPI void eobj_del(Eobj *obj);
* @brief Create a new weak reference to obj.
* @param obj The object being referenced.
* @param wref The pointer to use for the weak ref.
* @return The object being referenced (obj).
*/
EAPI void eobj_weak_ref_add(const Eobj *obj, Eobj **wref);
EAPI Eobj *eobj_weak_ref_add(const Eobj *obj, Eobj **wref);
/**
* @brief Free the weak reference passed.

View File

@ -1089,14 +1089,16 @@ _eobj_weak_ref_cb(void *data, Eobj *obj EINA_UNUSED, const Eobj_Event_Descriptio
return EOBJ_CALLBACK_CONTINUE;
}
EAPI void
EAPI Eobj *
eobj_weak_ref_add(const Eobj *_obj, Eobj **wref)
{
Eobj *obj = (Eobj *) _obj;
EOBJ_MAGIC_RETURN(obj, EOBJ_EINA_MAGIC);
EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, obj);
*wref = obj;
eobj_event_callback_add(obj, EOBJ_EV_DEL, _eobj_weak_ref_cb, wref);
return obj;
}
EAPI void