forked from enlightenment/efl
eo: Fix crashes with call cache after init cycle
It's not enough to check the init generation count, if the cache data is not reset properly. This patch adds safety in two ways: 1. Actually reset the op call cache when we detect a new generation 2. Verify that we don't return NULL function pointer The 1st point is absolutely necessary, 2nd is optional (extra cost of one if()). @fix
This commit is contained in:
parent
f839905184
commit
0ae529ac19
|
@ -1231,6 +1231,7 @@ typedef struct _Efl_Object_Call_Cache
|
||||||
// hits.
|
// hits.
|
||||||
#define EFL_FUNC_COMMON_OP_END(Obj, Name, DefRet) \
|
#define EFL_FUNC_COMMON_OP_END(Obj, Name, DefRet) \
|
||||||
__##Name##_op_create: \
|
__##Name##_op_create: \
|
||||||
|
if (EINA_UNLIKELY(___cache.op != EFL_NOOP)) memset(&___cache, 0, sizeof(___cache)); \
|
||||||
___cache.op = _efl_object_op_api_id_get(EFL_FUNC_COMMON_OP_FUNC(Name), Obj, #Name, __FILE__, __LINE__); \
|
___cache.op = _efl_object_op_api_id_get(EFL_FUNC_COMMON_OP_FUNC(Name), Obj, #Name, __FILE__, __LINE__); \
|
||||||
if (___cache.op == EFL_NOOP) return DefRet; \
|
if (___cache.op == EFL_NOOP) return DefRet; \
|
||||||
___cache.generation = _efl_object_init_generation; \
|
___cache.generation = _efl_object_init_generation; \
|
||||||
|
|
|
@ -498,6 +498,7 @@ ok_klass_back:
|
||||||
call->func = func->func;
|
call->func = func->func;
|
||||||
if (is_obj)
|
if (is_obj)
|
||||||
call->data = (char *)obj + cache->off[i].off;
|
call->data = (char *)obj + cache->off[i].off;
|
||||||
|
if (EINA_UNLIKELY(!call->func)) goto err_cache_op;
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue