efl_ui_pager: ensure objects are added and deduplicated
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Fri, 26 Apr 2019 15:19:37 +0000 (17:19 +0200)
committerHermet Park <hermetpark@gmail.com>
Wed, 8 May 2019 04:25:02 +0000 (13:25 +0900)
everything else will make things fall apart

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

src/lib/elementary/efl_ui_pager.c

index e5856a8..b97737a 100644 (file)
@@ -401,6 +401,14 @@ _efl_ui_pager_efl_container_content_count(Eo *obj EINA_UNUSED,
 static Eina_Bool
 _register_child(Eo *obj EINA_UNUSED, Efl_Ui_Pager_Data *pd, Efl_Gfx_Entity *subobj)
 {
+   if (eina_list_data_find(pd->content_list, subobj))
+     {
+        ERR("Object already added!");
+        return EINA_FALSE;
+     }
+   if (!efl_ui_widget_sub_object_add(obj, subobj))
+     return EINA_FALSE;
+
    if (!pd->transition)
      efl_canvas_object_clipper_set(subobj, pd->backclip);