forked from enlightenment/efl
Eobj: Make eobj_weak_ref_add return the obejct being reffed.
Suggested by vtorri. SVN revision: 70418
This commit is contained in:
parent
5b529c506b
commit
31e6682a66
|
@ -545,8 +545,9 @@ EAPI void eobj_del(Eobj *obj);
|
||||||
* @brief Create a new weak reference to obj.
|
* @brief Create a new weak reference to obj.
|
||||||
* @param obj The object being referenced.
|
* @param obj The object being referenced.
|
||||||
* @param wref The pointer to use for the weak ref.
|
* @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.
|
* @brief Free the weak reference passed.
|
||||||
|
|
|
@ -1089,14 +1089,16 @@ _eobj_weak_ref_cb(void *data, Eobj *obj EINA_UNUSED, const Eobj_Event_Descriptio
|
||||||
return EOBJ_CALLBACK_CONTINUE;
|
return EOBJ_CALLBACK_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI Eobj *
|
||||||
eobj_weak_ref_add(const Eobj *_obj, Eobj **wref)
|
eobj_weak_ref_add(const Eobj *_obj, Eobj **wref)
|
||||||
{
|
{
|
||||||
Eobj *obj = (Eobj *) _obj;
|
Eobj *obj = (Eobj *) _obj;
|
||||||
EOBJ_MAGIC_RETURN(obj, EOBJ_EINA_MAGIC);
|
EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, obj);
|
||||||
|
|
||||||
*wref = obj;
|
*wref = obj;
|
||||||
eobj_event_callback_add(obj, EOBJ_EV_DEL, _eobj_weak_ref_cb, wref);
|
eobj_event_callback_add(obj, EOBJ_EV_DEL, _eobj_weak_ref_cb, wref);
|
||||||
|
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
|
Loading…
Reference in New Issue