diff options
author | Chris Michael <devilhorns@comcast.net> | 2018-09-06 13:21:55 +0000 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2018-09-06 18:20:56 +0200 |
commit | 84423a465ca2254a38a28bf6e0c62342340d13ad (patch) | |
tree | 54a36b49a7078b3183b301e768ce6619151a37b4 | |
parent | bae53f7d72bb5b226f03f3b51d934a5531d41820 (diff) | |
download | efl-84423a465ca2254a38a28bf6e0c62342340d13ad.tar.gz |
elementary: Check for valid focus manager before starting do loop
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
Differential Revision: https://phab.enlightenment.org/D6704
-rw-r--r-- | src/lib/elementary/efl_ui_focus_util.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/src/lib/elementary/efl_ui_focus_util.c b/src/lib/elementary/efl_ui_focus_util.c index aa342a92f4..b0b5bedd8c 100644 --- a/src/lib/elementary/efl_ui_focus_util.c +++ b/src/lib/elementary/efl_ui_focus_util.c @@ -31,26 +31,32 @@ _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; - 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); - if (efl_isa(m, EFL_UI_WIN_CLASS)) - { - //we are at the root of the window, we can set the focus to the object - efl_ui_focus_manager_focus_set(registered_manager, user); - return; - } - - //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); + do + { + if (m) + { + //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); + if (efl_isa(m, EFL_UI_WIN_CLASS)) + { + //we are at the root of the window, we can set the focus to the object + efl_ui_focus_manager_focus_set(registered_manager, user); + return; + } + } + + //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); } EOLIAN static Efl_Ui_Focus_Manager* |