elm/list: block recursive recalc loops

Summary:
this size hints callback is triggered by both list objects and list
item objects, meaning that setting size hints on the item objects during
recalc will trigger a recursive recalc, potentially infinitely

this blocks recursive recalcs unless triggered by size hint changes
from a main list object, since those will eventually resolve themselves

fix T7121

Reviewers: devilhorns, Hermet

Reviewed By: Hermet

Subscribers: netstar, DaveMDS, cedric, #committers

Tags: #efl_widgets

Maniphest Tasks: T7121

Differential Revision: https://phab.enlightenment.org/D6572
This commit is contained in:
Mike Blumenkrantz 2018-07-19 17:01:05 +09:00 committed by Hermet Park
parent b00f0e0630
commit 5e64ddec31
2 changed files with 9 additions and 1 deletions

View File

@ -851,6 +851,7 @@ _items_fix(Evas_Object *obj)
}
_elm_list_walk(obj, sd); // watch out "return" before unwalk!
sd->fixing_now = EINA_TRUE;
eina_array_step_set(&walk, sizeof (walk), 8);
@ -1036,6 +1037,7 @@ _items_fix(Evas_Object *obj)
efl_unref(eo_it);
}
sd->fixing_now = EINA_FALSE;
_elm_list_unwalk(obj, sd);
//focus highlight in_theme is set by list item theme.
@ -1046,12 +1048,17 @@ _items_fix(Evas_Object *obj)
static void
_size_hints_changed_cb(void *data,
Evas *e EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
Evas_Object *obj,
void *event_info EINA_UNUSED)
{
ELM_LIST_DATA_GET(data, sd);
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
if (sd->delete_me) return;
if (sd->fixing_now)
{
if ((obj != wd->resize_obj) && (obj != sd->box)) return;
}
_items_fix(data);
elm_layout_sizing_eval(data);
}

View File

@ -64,6 +64,7 @@ struct _Elm_List_Data
Eina_Bool mouse_down : 1; /**< a flag that mouse is down on the list at the moment. this flag is set to true on mouse and reset to false on mouse up */
Eina_Bool item_loop_enable : 1; /**< value whether item loop feature is enabled or not. */
Eina_Bool item_looping_on : 1;
Eina_Bool fixing_now : 1;
};
struct _Elm_List_Item_Data