Eo: remove strict class checking for composite objects.
authorTom Hacohen <tom@stosb.com>
Sun, 5 Jun 2016 08:58:19 +0000 (09:58 +0100)
committerTom Hacohen <tom@stosb.com>
Sun, 5 Jun 2016 09:57:07 +0000 (10:57 +0100)
When compositing objects, we were checking that class_of(B) is in A's
inheritance tree before allowing attaching B as a composite object of A.
This is wrong and breaks a few cases, for example: B extends a class that
is in A's inheritance tree or B implements an interface that is in A's
inheritance tree.

Thanks to Marcel for reporting.

src/lib/eo/eo_base_class.c
src/tests/eo/composite_objects/composite_objects_main.c

index 5d8601b..e378b70 100644 (file)
@@ -1242,11 +1242,6 @@ _eo_base_composite_attach(Eo *parent_id, Eo_Base_Data *pd EINA_UNUSED, Eo *comp_
    EO_OBJ_POINTER_RETURN_VAL(comp_obj_id, comp_obj, EINA_FALSE);
    EO_OBJ_POINTER_RETURN_VAL(parent_id, parent, EINA_FALSE);
 
-   if (!eo_isa(parent_id, _eo_class_id_get(comp_obj->klass)))
-     {
-        return EINA_FALSE;
-     }
-
    Eo_Base_Data *comp_pd = eo_data_scope_get(comp_obj_id, EO_BASE_CLASS);
    /* Don't composite if we already have a composite object of this type */
      {
index b32d5f9..e424192 100644 (file)
@@ -73,8 +73,6 @@ main(int argc, char *argv[])
    fail_if(!eo_composite_part_is(simple));
    fail_if(eo_composite_attach(obj, simple));
 
-   fail_if(eo_composite_attach(simple, obj));
-
    eo_unref(simple);
    eo_unref(obj);