From 364ca1d2b2bb057da4d4d02dbeb2cbc2045b0ee3 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Mon, 13 Aug 2018 07:27:55 -0400 Subject: [PATCH] elementary: Check for valid focus manager before starting do loop Summary: Apparently there are cases where efl_ui_focus_object_focus_manager_get can return NULL. In order to trap for this, we can simply modify the do loop slightly and check for a valid manager before we actually start looping Test Case: elementary_test -to "Panel Scrollable" and click Toggle button ref T7030 Depends on D6703 Reviewers: bu5hm4n, YOhoho Subscribers: #reviewers, cedric, #committers, zmike Tags: #efl_widgets_focus Maniphest Tasks: T7030 Differential Revision: https://phab.enlightenment.org/D6704 --- src/lib/elementary/efl_ui_focus_util.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lib/elementary/efl_ui_focus_util.c b/src/lib/elementary/efl_ui_focus_util.c index aa342a92f4..4dc7c3ad49 100644 --- a/src/lib/elementary/efl_ui_focus_util.c +++ b/src/lib/elementary/efl_ui_focus_util.c @@ -31,6 +31,14 @@ _efl_ui_focus_util_focus(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Focus registered_manager = m = efl_ui_focus_object_focus_manager_get(user); entry = user; + if (!m) + { + //delayed focusung + efl_key_data_set(top, "__delayed_focus_set", entry); + efl_event_callback_add(entry, EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED, _manager_changed, user); + return; + } + do { //check if the root of a manager is the window root, set focus to this object in the manager than entry = efl_ui_focus_manager_root_get(m); @@ -43,13 +51,6 @@ _efl_ui_focus_util_focus(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Focus //if there is no manager yet, delay the focus setting until this entity gets registered for one chain m = efl_ui_focus_object_focus_manager_get(entry); - if (!m) - { - //delayed focusung - efl_key_data_set(top, "__delayed_focus_set", entry); - efl_event_callback_add(entry, EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED, _manager_changed, user); - return; - } } while (m); }