summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2016-11-12 13:56:24 -0800
committerCedric Bail <cedric@osg.samsung.com>2016-11-12 13:56:24 -0800
commit99b327598edbfccef066c3a185d4dbe490401782 (patch)
tree77362372a20e19bfe1339b977a4ce2e96e697bd6
parent202dc8c189612fd4fca34aa85a5fb17a2c72d5f6 (diff)
downloadefl-99b327598edbfccef066c3a185d4dbe490401782.tar.gz
evas: protect against wrong request to default seat.
Enlightenment kept crashing without this patch.
-rw-r--r--src/lib/evas/canvas/evas_focus.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/lib/evas/canvas/evas_focus.c b/src/lib/evas/canvas/evas_focus.c
index 96cf0ca947..c09ba28e72 100644
--- a/src/lib/evas/canvas/evas_focus.c
+++ b/src/lib/evas/canvas/evas_focus.c
@@ -30,6 +30,7 @@ _default_seat_get(Eo *evas_obj)
Evas *evas = evas_object_evas_get(evas_obj);
edata = efl_data_scope_get(evas, EVAS_CANVAS_CLASS);
+ if (!edata) return NULL;
return edata->default_seat;
}
@@ -94,15 +95,13 @@ _efl_canvas_object_seat_focus_del(Eo *eo_obj,
Efl_Input_Device *seat)
{
Eina_List *l;
- Efl_Input_Device *dev, *def;
+ Efl_Input_Device *dev;
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return EINA_FALSE;
MAGIC_CHECK_END();
- def = _default_seat_get(eo_obj);
- if (!seat)
- seat = def;
+ if (!seat) seat = _default_seat_get(eo_obj);
EINA_LIST_FOREACH(obj->focused_by_seats, l, dev)
{
@@ -130,15 +129,12 @@ _efl_canvas_object_seat_focus_add(Eo *eo_obj,
Efl_Input_Device *seat)
{
Eo *current_focus;
- Efl_Input_Device *def;
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return EINA_FALSE;
MAGIC_CHECK_END();
- def = _default_seat_get(eo_obj);
- if (!seat)
- seat = def;
+ if (!seat) seat = _default_seat_get(eo_obj);
EINA_SAFETY_ON_NULL_RETURN_VAL(seat, EINA_FALSE);
if (efl_input_device_type_get(seat) != EFL_INPUT_DEVICE_CLASS_SEAT)
@@ -161,8 +157,9 @@ _efl_canvas_object_seat_focus_add(Eo *eo_obj,
obj->focused_by_seats = eina_list_append(obj->focused_by_seats, seat);
_evas_focus_set(eo_obj, seat, EINA_TRUE);
+
//Legacy events...
- if (seat == def)
+ if (seat == _default_seat_get(eo_obj))
{
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_FOCUS_IN,
NULL, _evas_object_event_new(),
@@ -190,8 +187,7 @@ _efl_canvas_object_seat_focus_check(Eo *eo_obj,
return EINA_FALSE;
MAGIC_CHECK_END();
- if (!seat)
- seat = _default_seat_get(eo_obj);
+ if (!seat) seat = _default_seat_get(eo_obj);
EINA_LIST_FOREACH(obj->focused_by_seats, l, s)
{