Evas layer: Fix deletion of canvas with still-refed objects.

This fixes the infinite loop while deleting canvases with still
referenced objects.
The canvas should not assume it can get rid of all of the objects. Some
objects might be referenced. I also added a printf to let the user know
about it.

This fixes T565.
This commit is contained in:
Tom Hacohen 2013-11-26 11:46:49 +00:00
parent bff48f92a3
commit bb4a19b5ad
2 changed files with 8 additions and 6 deletions

View File

@ -77,11 +77,10 @@ evas_layer_pre_free(Evas_Layer *lay)
void
evas_layer_free_objects(Evas_Layer *lay)
{
while (lay->objects)
{
Evas_Object_Protected_Data *obj;
Evas_Object_Protected_Data *obj;
obj = (Evas_Object_Protected_Data *)lay->objects;
EINA_INLIST_FREE(lay->objects, obj)
{
evas_object_free(obj->object, 0);
}
}

View File

@ -233,8 +233,11 @@ _destructor(Eo *eo_e, void *_pd, va_list *list EINA_UNUSED)
{
if (!o->delete_me)
{
if (o->ref > 0)
ERR("obj(%p, %s) ref count(%d) is bigger than 0. This object couldn't be deleted", o, o->type, o->ref);
if ((o->ref > 0) || (eo_ref_get(o->object) > 0))
{
ERR("obj(%p, %s) ref count(%d) is bigger than 0. This object couldn't be deleted", o, o->type, eo_ref_get(o->object));
continue;
}
del = EINA_TRUE;
}
}