evas: better patch for preventing infinite loop.

SVN revision: 61520
This commit is contained in:
Cedric BAIL 2011-07-20 09:14:41 +00:00
parent cfaac57a76
commit e18334a778
1 changed files with 19 additions and 10 deletions

View File

@ -531,6 +531,14 @@ evas_object_smart_need_recalculate_set(Evas_Object *obj, Eina_Bool value)
value = !!value; value = !!value;
if (o->need_recalculate == value) if (o->need_recalculate == value)
return; return;
if (obj->recalculate_cycle > 64)
{
ERR("Object %p is not stable during recalc loop", obj);
return ;
}
if (obj->layer->evas->in_smart_calc)
obj->recalculate_cycle++;
o->need_recalculate = value; o->need_recalculate = value;
if (!obj->smart.smart->smart_class->calculate) return; if (!obj->smart.smart->smart_class->calculate) return;
@ -600,31 +608,32 @@ void
evas_call_smarts_calculate(Evas *e) evas_call_smarts_calculate(Evas *e)
{ {
Eina_Array *calculate; Eina_Array *calculate;
unsigned int i;
static int in_smart_calc = 0;
in_smart_calc++;
calculate = &e->calculate_objects;
for (i = 0; i < calculate->count; i++)
{
Evas_Object *obj; Evas_Object *obj;
Evas_Object_Smart *o; Eina_Array_Iterator it;
int before; unsigned int i;
e->in_smart_calc++;
calculate = &e->calculate_objects;
EINA_ARRAY_ITER_NEXT(calculate, i, obj, it)
{
Evas_Object_Smart *o;
obj = eina_array_data_get(calculate, i);
if (obj->delete_me) if (obj->delete_me)
continue; continue;
before = calculate->count;
o = obj->object_data; o = obj->object_data;
if (o->need_recalculate) if (o->need_recalculate)
{ {
obj->smart.smart->smart_class->calculate(obj);
o->need_recalculate = 0; o->need_recalculate = 0;
obj->smart.smart->smart_class->calculate(obj);
} }
} }
in_smart_calc--; EINA_ARRAY_ITER_NEXT(calculate, i, obj, it)
if (in_smart_calc == 0) eina_array_flush(calculate); {
obj->recalculate_cycle = 0;
}
e->in_smart_calc--;
if (e->in_smart_calc == 0) eina_array_clean(calculate);
} }
EAPI void EAPI void