evas_focus: protect against faulty focus object
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Mon, 9 Dec 2019 20:40:10 +0000 (21:40 +0100)
committerJongmin Lee <jm105.lee@samsung.com>
Mon, 16 Dec 2019 03:26:45 +0000 (12:26 +0900)
the problem is that we only remove ourselfs from the focused list in the
invalidator. However, we allowed invalidated objects to be part of this
hash, which made everything go boom.

With this commit you at least only get one error and you should fix up
this case.

This fixes random errors in enlightenment (That are appearing theire
since seats have been introduced to evas, the problem before invalidate
was that the object was already destructor called, but not fully
destructed yet).

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10845

src/lib/evas/canvas/evas_focus.c

index e11df78..83678fc 100644 (file)
@@ -223,6 +223,8 @@ _efl_canvas_object_seat_focus_add(Eo *eo_obj,
    return EINA_FALSE;
    MAGIC_CHECK_END();
 
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(!efl_invalidating_get(eo_obj) && !efl_invalidated_get(eo_obj), EINA_FALSE);
+
    event_id = _evas_event_counter;
    if (seat) default_seat = _default_seat_get(eo_obj);
    else default_seat = seat = _default_seat_get(eo_obj);