Guard box from getting into an infinite loop when calculating layout.

SVN revision: 38182
This commit is contained in:
Iván Briano 2008-12-17 14:10:09 +00:00
parent 3d41b74146
commit 05af27f999
2 changed files with 9 additions and 1 deletions

View File

@ -1017,6 +1017,7 @@ extern "C" {
void *data;
void (*free_data)(void *data);
} layout;
unsigned char in_calc:1;
};
struct _Evas_Object_Box_Option

View File

@ -37,6 +37,9 @@ static void
_on_child_resize(void *data, Evas *evas, Evas_Object *o, void *einfo)
{
Evas_Object *box = data;
Evas_Object_Box_Data *priv;
priv = evas_object_smart_data_get(box);
if (priv->in_calc) return;
evas_object_smart_changed(box);
}
@ -378,7 +381,11 @@ _evas_object_box_smart_calculate(Evas_Object *o)
{
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(o, priv);
if (priv->layout.cb)
priv->layout.cb(o, priv, priv->layout.data);
{
priv->in_calc = 1;
priv->layout.cb(o, priv, priv->layout.data);
priv->in_calc = 0;
}
else
fprintf(stderr, "ERROR: no layout function set for %p box.\n", o);
}