eo - now ref and unref objects on each eo call to keep things safe

so... i got this ... callback calls callback calls something calls
callback that deletes the original object at the top so when it comes
back ... things die as the object was destructed. in removing eo_do()
we removed the ref/unrefs that went with it. so this uses the
_EO_API_BEFORE_HOOK and _EO_API_AFTER_HOOK to call exposed "internal"
public functions _eo_real_ref() and _eo_real_unref().

this fixes a new segv i've noticed in several e dialogs where hitting
close does the above via callbacks and closes the window etc.
This commit is contained in:
Carsten Haitzler 2016-05-23 11:15:53 +09:00
parent b8b41e6683
commit 4044fe6504
2 changed files with 17 additions and 2 deletions

View File

@ -560,8 +560,11 @@ typedef struct _Eo_Call_Cache
__FILE__, __LINE__)) return DefRet; \
_Eo_##Name##_func _func_ = (_Eo_##Name##_func) ___call.func; \
#define _EO_API_BEFORE_HOOK
#define _EO_API_AFTER_HOOK
EAPI void _eo_real_ref(_Eo_Object *obj);
EAPI void _eo_real_unref(_Eo_Object *obj);
#define _EO_API_BEFORE_HOOK _eo_real_ref(___call.obj);
#define _EO_API_AFTER_HOOK _eo_real_unref(___call.obj);
#define _EO_API_CALL_HOOK(x) x
// to define an EAPI function

View File

@ -1421,6 +1421,18 @@ eo_xunref(Eo *obj_id, const Eo *ref_obj_id)
_eo_unref(obj);
}
EAPI void
_eo_real_ref(_Eo_Object *obj)
{
if (obj) _eo_ref(obj);
}
EAPI void
_eo_real_unref(_Eo_Object *obj)
{
if (obj) _eo_unref(obj);
}
EAPI Eo *
eo_ref(const Eo *obj_id)
{