eo: Fix deadlock in efl_parent_set

If the object is shared and the given parent is invalid (eg. deleted)
then we will deadlock later. This also adds a test case with it.
This commit is contained in:
Jean-Philippe Andre 2016-10-06 16:19:12 +09:00
parent 7db67aaea8
commit 6ce60a0de5
2 changed files with 12 additions and 0 deletions

View File

@ -582,13 +582,17 @@ _efl_object_parent_set(Eo *obj, Efl_Object_Data *pd, Eo *parent_id)
EO_OBJ_DONE(obj);
return;
err_parent:
ERR("New parent %p for object %p is not a valid Eo object.",
parent_id, obj);
EO_OBJ_DONE(obj);
return;
err_impossible:
ERR("CONTACT DEVS!!! SHOULD NEVER HAPPEN!!! Old parent %p for object %p is not a valid Eo object.",
pd->parent, obj);
EO_OBJ_DONE(obj);
}
EOLIAN static Eo *

View File

@ -1371,6 +1371,7 @@ thr1(void *data, Eina_Thread t EINA_UNUSED)
{
Data *d = data;
Efl_Id_Domain dom;
Eo *objs2;
fail_if(efl_domain_switch(EFL_ID_DOMAIN_THREAD) != EINA_TRUE);
fail_if(efl_domain_get() != EFL_ID_DOMAIN_THREAD);
@ -1381,6 +1382,13 @@ thr1(void *data, Eina_Thread t EINA_UNUSED)
printf("VERIFY finalized_get()\n");
fail_if(!efl_finalized_get(d->objs));
printf("VERIFY parent_set(invalid)\n");
efl_domain_current_push(EFL_ID_DOMAIN_SHARED);
objs2 = efl_add(DOMAIN_CLASS, NULL);
efl_domain_current_pop();
efl_del(objs2);
efl_parent_set(d->objs, objs2);
printf("SET ON LOCAL\n");
domain_a_set(obj, 1234);
fail_if(domain_a_get(obj) != 1234);