efl_ui_spotlight_manager_*: do not keep ptr of dead pointer
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Mon, 9 Dec 2019 20:02:26 +0000 (21:02 +0100)
committerJongmin Lee <jm105.lee@samsung.com>
Mon, 16 Dec 2019 03:26:45 +0000 (12:26 +0900)
when content is deleted, we should not keep a dangling pointer of it.
Setting it to NULL here is enough, as later on a swtich_to reuest will
be sent.

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

src/lib/elementary/efl_ui_spotlight_manager_plain.c
src/lib/elementary/efl_ui_spotlight_manager_stack.c

index 83aab8f..d9c52ab 100644 (file)
@@ -90,6 +90,8 @@ EOLIAN static void
 _efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_content_del(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
 {
    efl_canvas_group_member_remove(pd->container, subobj);
+   if (pd->current_content == subobj)
+     pd->current_content = NULL;
    _content_changed(obj, pd);
 }
 EOLIAN static void
index b286d75..d7d6d94 100644 (file)
@@ -105,6 +105,11 @@ EOLIAN static void
 _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Efl_Gfx_Entity *subobj, int index)
 {
    efl_canvas_group_member_remove(pd->container, subobj);
+   for (int i = 0; i < 2; ++i)
+     {
+        if (pd->content[i] == subobj)
+          pd->content[i] = NULL;
+     }
    _update_ids(obj, pd, index);
 }