From 4c0167916bd472569a71f2888f32b49231dedb5e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 10 Oct 2017 19:30:38 +0900 Subject: [PATCH] focus: Avoid infinite loop in window I kept the safety error message for easier debugging. Test scenario: elementary_test -to "Window Inline" Click on an entry. Press Shift+Tab. Ping @bu5hm4n --- src/lib/elementary/efl_ui_focus_manager_root_focus.c | 1 + src/lib/elementary/efl_ui_win.c | 2 ++ src/lib/elementary/elm_interface_scrollable.c | 3 +-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_focus_manager_root_focus.c b/src/lib/elementary/efl_ui_focus_manager_root_focus.c index 4736f4a..700271b 100644 --- a/src/lib/elementary/efl_ui_focus_manager_root_focus.c +++ b/src/lib/elementary/efl_ui_focus_manager_root_focus.c @@ -67,6 +67,7 @@ _efl_ui_focus_manager_root_focus_efl_ui_focus_manager_calc_unregister(Eo *obj, E EOLIAN static void _efl_ui_focus_manager_root_focus_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_Manager_Root_Focus_Data *pd, Efl_Ui_Focus_Object *focus) { + EINA_SAFETY_ON_NULL_RETURN(focus); efl_ui_focus_manager_focus_set(efl_super(obj, MY_CLASS), _trap(pd, focus)); } diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 4a112e5..9f39bc4 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -1757,12 +1757,14 @@ _key_action_move(Evas_Object *obj, const char *params) do { last = efl_ui_focus_manager_logical_end(rec_manager); + EINA_SAFETY_ON_NULL_GOTO(last.element, end); efl_ui_focus_manager_focus_set(rec_manager, last.element); rec_manager = efl_ui_focus_manager_redirect_get(rec_manager); } while (!last.is_regular_end); } +end: return EINA_TRUE; } diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c index 6346453..1f8d67a 100644 --- a/src/lib/elementary/elm_interface_scrollable.c +++ b/src/lib/elementary/elm_interface_scrollable.c @@ -4731,10 +4731,9 @@ _elm_interface_scrollable_efl_ui_focus_manager_focus_set(Eo *obj, Elm_Scrollable Eina_Rectangle geom; int pan_x, pan_y; + EINA_SAFETY_ON_NULL_RETURN(focus); efl_ui_focus_manager_focus_set(efl_super(obj, MY_SCROLLABLE_INTERFACE), focus); - if (!focus) return; - evas_object_geometry_get(focus, &geom.x, &geom.y, &geom.w, &geom.h); elm_obj_pan_pos_get(pd->pan_obj, &pan_x, &pan_y); geom.x = geom.x + pan_x; -- 2.7.4