From a98518a9de4ad64f57bb7fbd31f2b2cb78ea95c9 Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Mon, 31 Oct 2011 23:22:07 +0000 Subject: [PATCH] E: gadcon width adjustment was entering an infinite loop if no gadget had autoscroll enabled the 'need' variable had to be initialized to 0, and a break condition for the loop also needed to be added otherwise we'd end up in an infinite loop if no gadget had autoscroll (in which case, the need var was never modified). SVN revision: 64587 --- src/bin/e_gadcon.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index af9570e67..4b88665c9 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -3715,7 +3715,8 @@ _e_gadcon_layout_smart_gadcons_width_adjust(E_Smart_Data *sd, int min, int cur) E_Gadcon_Layout_Item *bi = NULL; Eina_List *l, *l2; Evas_Object *item; - int need; + int needed = 0; + int need = 0; int max_size, autosize = 0; if (sd->w < cur) @@ -3738,6 +3739,7 @@ _e_gadcon_layout_smart_gadcons_width_adjust(E_Smart_Data *sd, int min, int cur) if (autosize < 1) autosize = 1; while (need > 0) { + needed = need; EINA_LIST_REVERSE_FOREACH(sd->items, l2, item) { if (need <= 0) break; @@ -3760,6 +3762,9 @@ _e_gadcon_layout_smart_gadcons_width_adjust(E_Smart_Data *sd, int min, int cur) } } } + /* If the 'needed' size change didn't get modified (no gadget has autoscroll) + then we must break or we end up in an infinite loop */ + if (need == needed) break; } }