forked from enlightenment/efl
eo2: fixed validity checks for eo2_do_super.
The class should be checked to be valid and non-null. This fixes the issues with eo_suite.
This commit is contained in:
parent
1890fdf27f
commit
ebae305a9e
|
@ -712,7 +712,7 @@ EAPI Eo_Op eo2_api_op_id_get(const void *api_func);
|
|||
EAPI Eina_Bool eo2_call_resolve(const char *func_name, const Eo_Op op, Eo2_Op_Call_Data *call);
|
||||
|
||||
// start of eo2_do barrier, gets the object pointer and ref it, put it on the stask
|
||||
EAPI Eina_Bool eo2_do_start(const Eo *obj, const Eo_Class *cur_klass, const char *file, const char *func, int line);
|
||||
EAPI Eina_Bool eo2_do_start(const Eo *obj, const Eo_Class *cur_klass, Eina_Bool is_super, const char *file, const char *func, int line);
|
||||
|
||||
// end of the eo2_do barrier, unref the obj, move the stack pointer
|
||||
EAPI void eo2_do_end(const Eo **ojb);
|
||||
|
@ -723,11 +723,11 @@ EAPI int eo2_call_stack_depth(void);
|
|||
|
||||
// eo object method calls batch,
|
||||
|
||||
#define _eo2_do_common(eoid, clsid, ...) \
|
||||
#define _eo2_do_common(eoid, clsid, is_super, ...) \
|
||||
do \
|
||||
{ \
|
||||
const Eo *_eoid_ = eoid; \
|
||||
if (eo2_do_start(_eoid_, clsid, __FILE__, __FUNCTION__, __LINE__)) \
|
||||
if (eo2_do_start(_eoid_, clsid, is_super, __FILE__, __FUNCTION__, __LINE__)) \
|
||||
{ \
|
||||
const Eo *_id_clean_ EO2_DO_CLEANUP = _eoid_; \
|
||||
__VA_ARGS__; \
|
||||
|
@ -736,9 +736,9 @@ EAPI int eo2_call_stack_depth(void);
|
|||
} while (0)
|
||||
|
||||
|
||||
#define eo2_do(eoid, ...) _eo2_do_common(eoid, NULL, __VA_ARGS__)
|
||||
#define eo2_do(eoid, ...) _eo2_do_common(eoid, NULL, EINA_FALSE, __VA_ARGS__)
|
||||
|
||||
#define eo2_do_super(eoid, clsid, func) _eo2_do_common(eoid, clsid, func)
|
||||
#define eo2_do_super(eoid, clsid, func) _eo2_do_common(eoid, clsid, EINA_TRUE, func)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ eo2_call_stack_depth()
|
|||
|
||||
static inline Eina_Bool
|
||||
_eo2_do_internal(const Eo *eo_id, const Eo_Class *cur_klass_id,
|
||||
Eo2_Stack_Frame *fptr, Eo2_Stack_Frame *pfptr)
|
||||
Eina_Bool is_super, Eo2_Stack_Frame *fptr, Eo2_Stack_Frame *pfptr)
|
||||
{
|
||||
/* If we are already in the same object context, we inherit info from it. */
|
||||
if (pfptr)
|
||||
|
@ -339,7 +339,7 @@ _eo2_do_internal(const Eo *eo_id, const Eo_Class *cur_klass_id,
|
|||
fptr->obj_data = EO2_INVALID_DATA;
|
||||
}
|
||||
|
||||
if (cur_klass_id)
|
||||
if (is_super)
|
||||
{
|
||||
EO_CLASS_POINTER_RETURN_VAL(cur_klass_id, cur_klass, EINA_FALSE);
|
||||
if (fptr->cur_klass == cur_klass)
|
||||
|
@ -355,7 +355,7 @@ _eo2_do_internal(const Eo *eo_id, const Eo_Class *cur_klass_id,
|
|||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
eo2_do_start(const Eo *eo_id, const Eo_Class *cur_klass_id, const char *file EINA_UNUSED, const char *func EINA_UNUSED, int line EINA_UNUSED)
|
||||
eo2_do_start(const Eo *eo_id, const Eo_Class *cur_klass_id, Eina_Bool is_super, const char *file EINA_UNUSED, const char *func EINA_UNUSED, int line EINA_UNUSED)
|
||||
{
|
||||
Eo2_Stack_Frame *fptr, *pfptr;
|
||||
|
||||
|
@ -369,7 +369,7 @@ eo2_do_start(const Eo *eo_id, const Eo_Class *cur_klass_id, const char *file EIN
|
|||
pfptr = ((eo_id) && (fptr->eo_id == eo_id) ? fptr : NULL);
|
||||
fptr++;
|
||||
|
||||
if (!_eo2_do_internal(eo_id, cur_klass_id, fptr, pfptr))
|
||||
if (!_eo2_do_internal(eo_id, cur_klass_id, is_super, fptr, pfptr))
|
||||
return EINA_FALSE;
|
||||
|
||||
if(_eo_is_a_class(eo_id))
|
||||
|
|
|
@ -595,7 +595,7 @@ START_TEST(eo_magic_checks)
|
|||
ck_assert_int_ne(i, a);
|
||||
eo2_do_super(obj, (const Eo_Class *) buf, simple_a_set(++i));
|
||||
eo2_do_super(obj, (const Eo_Class *) buf, a = simple_a_get());
|
||||
ck_assert_int_ne(i, a); // FIXME Jeremy: shouldn't happen. do_super should check for class validity and fail!
|
||||
ck_assert_int_ne(i, a);
|
||||
fail_if(eo_class_get((Eo *) buf));
|
||||
fail_if(eo_class_name_get((Eo_Class*) buf));
|
||||
fail_if(eo_class_get(obj) != SIMPLE_CLASS);
|
||||
|
@ -603,8 +603,7 @@ START_TEST(eo_magic_checks)
|
|||
eo_class_funcs_set((Eo_Class *) buf, NULL);
|
||||
eo2_do((Eo_Class *) buf, NULL);
|
||||
eo2_do_super((Eo_Class *) buf, SIMPLE_CLASS, simple_a_set(++i));
|
||||
eo2_do_super(SIMPLE_CLASS, (Eo_Class *) buf, simple_a_set(++i)); // FIXME Jeremy: For some reason it tries to call the object function on the class!!!
|
||||
|
||||
eo2_do_super(SIMPLE_CLASS, (Eo_Class *) buf, simple_a_set(++i));
|
||||
fail_if(eo_class_new(NULL, (Eo_Class *) buf), NULL);
|
||||
|
||||
eo_xref(obj, (Eo *) buf);
|
||||
|
|
Loading…
Reference in New Issue