efl_ui_box: print more errors,
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Mon, 1 Apr 2019 12:45:19 +0000 (14:45 +0200)
committerYeongjong Lee <yj34.lee@samsung.com>
Wed, 24 Apr 2019 05:24:47 +0000 (14:24 +0900)
when a element is added two times, we should print an error. Same for
removing a child that is not part of this container.

Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D8522

src/lib/elementary/efl_ui_box.c

index 91cdb59..ac5e8e0 100644 (file)
@@ -47,7 +47,10 @@ static inline Eina_Bool
 _efl_ui_box_child_register(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Gfx_Entity *subobj)
 {
    if (!subobj || (efl_canvas_object_render_parent_get(subobj) == obj))
-     return EINA_FALSE;
+     {
+        ERR("subobj %p %s is already added to this", subobj, efl_class_name_get(subobj) );
+        return EINA_FALSE;
+     }
 
    if (!efl_ui_widget_sub_object_add(obj, subobj))
      return EINA_FALSE;
@@ -66,6 +69,11 @@ _efl_ui_box_child_register(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Gfx_Entity *subobj)
 static inline Eina_Bool
 _efl_ui_box_child_unregister(Eo *obj, Efl_Ui_Box_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj)
 {
+   if (efl_canvas_object_render_parent_get(subobj) != obj)
+     {
+        ERR("subobj %p %s is not part of this widget", subobj, efl_class_name_get(subobj) );
+        return EINA_FALSE;
+     }
    if (!subobj || !_elm_widget_sub_object_redirect_to_top(obj, subobj))
      return EINA_FALSE;