diff options
author | Yeongjong Lee <yj34.lee@samsung.com> | 2019-05-29 17:24:30 +0900 |
---|---|---|
committer | Jaehyun Cho <jae_hyun.cho@samsung.com> | 2019-05-29 17:24:30 +0900 |
commit | 56ab05660e62b732434c82b4595d507adac5f823 (patch) | |
tree | da9c73cf2c29678d73df5108a638a669308b68bd | |
parent | e3a791c4b176b7c396b1f4c56cd7a1ad54f1b745 (diff) | |
download | efl-56ab05660e62b732434c82b4595d507adac5f823.tar.gz |
efl_ui_relative_layout: prevent infinite loop in chain calculation
Test Plan:
test code
```
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Eo *win, *layout, *btn1, *btn2, *btn3;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get());
layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, win,
efl_content_set(win, efl_added));
btn1 = efl_add(EFL_UI_BUTTON_CLASS, layout);
btn2 = efl_add(EFL_UI_BUTTON_CLASS, layout);
efl_ui_relative_layout_relation_right_set(layout, btn1, btn2, 0.0);
efl_ui_relative_layout_relation_right_set(layout, btn2, btn1, 0.0);
efl_ui_relative_layout_relation_left_set(layout, btn2, btn1, 1.0);
efl_ui_relative_layout_relation_left_set(layout, btn1, btn2, 1.0);
elm_run();
return 0;
}
ELM_MAIN()
```
Reviewers: Jaehyun_Cho
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9032
-rw-r--r-- | src/lib/elementary/efl_ui_relative_layout.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/elementary/efl_ui_relative_layout.c b/src/lib/elementary/efl_ui_relative_layout.c index a0814cebad..7e8b6f3c01 100644 --- a/src/lib/elementary/efl_ui_relative_layout.c +++ b/src/lib/elementary/efl_ui_relative_layout.c @@ -218,7 +218,15 @@ _child_chain_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis) // find head head = child; while (head == head->calc.to[START]->calc.to[END]) - head = head->calc.to[START]; + { + head = head->calc.to[START]; + if (head == child) + { + ERR("%c-axis circular dependency when calculating \"%s\"(%p).", + axis ? 'Y' : 'X', efl_class_name_get(child->obj), child->obj); + return EINA_TRUE; + } + } //calculate weight_sum aspect_type = !axis ? EFL_GFX_HINT_ASPECT_VERTICAL : EFL_GFX_HINT_ASPECT_HORIZONTAL; |