forked from enlightenment/efl
eo: let's make weak ref safer to manipulate.
SVN revision: 81899
This commit is contained in:
parent
33791572fc
commit
35a5c733ff
|
@ -961,20 +961,52 @@ enum {
|
|||
*/
|
||||
#define eo_wref_del(wref) EO_BASE_ID(EO_BASE_SUB_ID_WREF_DEL), EO_TYPECHECK(Eo **, wref)
|
||||
|
||||
/**
|
||||
* @def eo_weak_ref
|
||||
* @brief Reference a pointer to an Eo object
|
||||
* @param wref the pointer to use for the weak ref
|
||||
*
|
||||
* Same as eo_wref_add() with the difference that it call eo_do() itself. Checking
|
||||
* for *wref NULL and making sure that you pass the right pointer to both side of
|
||||
* eo_do().
|
||||
*
|
||||
* @see eo_weak_unref
|
||||
* @see eo_wref_add
|
||||
*/
|
||||
#define eo_weak_ref(wref) \
|
||||
do { \
|
||||
if (*wref) eo_do(*wref, eo_wref_add(wref)); \
|
||||
} while (0);
|
||||
|
||||
/**
|
||||
* @def eo_weak_unref
|
||||
* @brief Unreference a pointer to an Eo object
|
||||
* @param wref the pointer to use for the weak unref
|
||||
*
|
||||
* Same as eo_wref_del() with the difference that it call eo_do() itself. Checking
|
||||
* for *wref NULL and making sure that you pass the right pointer to both side of
|
||||
* eo_do().
|
||||
*
|
||||
* @see eo_weak_ref
|
||||
* @see eo_wref_del
|
||||
* @see eo_wref_del_safe
|
||||
*/
|
||||
#define eo_weak_unref(wref) \
|
||||
do { \
|
||||
if (*wref) eo_do(*wref, eo_wref_del(wref)); \
|
||||
} while (0);
|
||||
|
||||
/**
|
||||
* @def eo_wref_del_safe
|
||||
* @brief Delete the weak reference passed.
|
||||
* @param wref the weak reference to free.
|
||||
*
|
||||
* Same as eo_wref_del(), with the different that it's not called from eobj_do()
|
||||
* Same as eo_wref_del(), with the different that it's not called from eo_do()
|
||||
* so you don't need to check if *wref is not NULL.
|
||||
*
|
||||
* @see #eo_wref_del
|
||||
*/
|
||||
#define eo_wref_del_safe(wref) \
|
||||
do { \
|
||||
if (*wref) eo_do(*wref, eo_wref_del(wref)); \
|
||||
} while (0)
|
||||
#define eo_wref_del_safe(wref) eo_weak_unref(wref)
|
||||
|
||||
/**
|
||||
* @def eo_constructor
|
||||
|
|
Loading…
Reference in New Issue