diff options
author | Chris Michael <cp.michael@samsung.com> | 2018-08-14 15:45:30 +0100 |
---|---|---|
committer | Alastair Poole <netstar@gmail.com> | 2018-08-14 15:45:57 +0100 |
commit | 6119cc0c65f0a8e1de6e330892f61d95e1b7bd50 (patch) | |
tree | 59507812167d75d0d2faaa028de8a81b07e211b1 | |
parent | 59b8a63d658017bfab86d64e6f7e2bb1c23b636a (diff) | |
download | efl-6119cc0c65f0a8e1de6e330892f61d95e1b7bd50.tar.gz |
elementary: Check for valid cursor_rect when (un)setting focus
Summary:
As the cursor_rect for elm_code_widget is not created until the code
widget gets focus, we cannot just assume it is already there when
trying to emit a focus signal. The cursor_rect does not get created
until widget_cursor_update is called.
This fixes an issue where NULL is passed to efl_layout_signal_emit.
To test this, just launch elementary_test and click the Code Editor
test. As soon as you try to click into the Code Editor, this gets
triggered.
ref T7030
Reviewers: netstar, ajwillia.ms
Reviewed By: netstar
Subscribers: #reviewers, cedric, #committers, zmike
Tags: #efl
Maniphest Tasks: T7030
Differential Revision: https://phab.enlightenment.org/D6701
-rw-r--r-- | src/lib/elementary/elm_code_widget.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c index f9798458a3..f78a78daa8 100644 --- a/src/lib/elementary/elm_code_widget.c +++ b/src/lib/elementary/elm_code_widget.c @@ -1833,7 +1833,8 @@ _elm_code_widget_focused_event_cb(void *data, Evas_Object *obj, pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); pd->focussed = EINA_TRUE; - elm_layout_signal_emit(pd->cursor_rect, "elm,action,focus", "elm"); + if (pd->cursor_rect) + elm_layout_signal_emit(pd->cursor_rect, "elm,action,focus", "elm"); _elm_code_widget_refresh(obj, NULL); } @@ -1849,7 +1850,8 @@ _elm_code_widget_unfocused_event_cb(void *data, Evas_Object *obj, pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); pd->focussed = EINA_FALSE; - elm_layout_signal_emit(pd->cursor_rect, "elm,action,unfocus", "elm"); + if (pd->cursor_rect) + elm_layout_signal_emit(pd->cursor_rect, "elm,action,unfocus", "elm"); _elm_code_widget_refresh(obj, NULL); } |