bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=5dac20f69f8c99757e18b920737adf95aecc8113

commit 5dac20f69f8c99757e18b920737adf95aecc8113
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Tue Jul 16 13:40:15 2019 -0400

    efl_ui_widget: add safety checks to verify parents aren't being added as 
children
    
    somehow it was never checked to see if a parent was being added as a 
subobject
    of a parent's own child object (recursive hierarchy)
    
    @fix
    
    Reviewed-by: Marcel Hollerbach <m...@marcel-hollerbach.de>
    Differential Revision: https://phab.enlightenment.org/D9333
---
 src/lib/elementary/efl_ui_widget.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/lib/elementary/efl_ui_widget.c 
b/src/lib/elementary/efl_ui_widget.c
index 7560fe3151..36df2e2e7c 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -1406,6 +1406,11 @@ _efl_ui_widget_widget_parent_set(Eo *obj, 
Elm_Widget_Smart_Data *pd, Efl_Ui_Widg
      {
         ELM_WIDGET_DATA_GET_OR_RETURN(parent, ppd);
         EINA_SAFETY_ON_FALSE_RETURN(eina_list_data_find(ppd->subobjs, obj));
+        if (ppd->parent_obj == parent)
+          {
+             CRI("ATTEMPTING TO SET CHILD OF PARENT AS PARENT OF ITS OWN 
PARENT. THIS IS A BUG.");
+             return;
+          }
      }
 
    /* NOTE: In the following two lines, 'obj' is correct. Do not change it.
@@ -1495,6 +1500,12 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, 
Elm_Widget_Smart_Data *sd, Evas_Ob
    if (parent == obj) return EINA_TRUE;
    if (parent)
      {
+        if (sd->parent_obj == sobj)
+          {
+             CRI("ATTEMPTING TO SET CHILD OF PARENT AS PARENT OF ITS OWN 
PARENT. THIS IS A BUG.");
+             return EINA_FALSE;
+          }
+
         if (!efl_ui_widget_sub_object_del(parent, sobj))
           return EINA_FALSE;
      }

-- 


Reply via email to