summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-16 13:40:15 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-22 10:44:30 +0200
commit5dac20f69f8c99757e18b920737adf95aecc8113 (patch)
tree05678ffe7df05df6f170225560f72783a3621e35
parent6da5bd35a9e10c1229a213894795ec841936eee1 (diff)
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 <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9333
-rw-r--r--src/lib/elementary/efl_ui_widget.c11
1 files changed, 11 insertions, 0 deletions
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
1406 { 1406 {
1407 ELM_WIDGET_DATA_GET_OR_RETURN(parent, ppd); 1407 ELM_WIDGET_DATA_GET_OR_RETURN(parent, ppd);
1408 EINA_SAFETY_ON_FALSE_RETURN(eina_list_data_find(ppd->subobjs, obj)); 1408 EINA_SAFETY_ON_FALSE_RETURN(eina_list_data_find(ppd->subobjs, obj));
1409 if (ppd->parent_obj == parent)
1410 {
1411 CRI("ATTEMPTING TO SET CHILD OF PARENT AS PARENT OF ITS OWN PARENT. THIS IS A BUG.");
1412 return;
1413 }
1409 } 1414 }
1410 1415
1411 /* NOTE: In the following two lines, 'obj' is correct. Do not change it. 1416 /* 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
1495 if (parent == obj) return EINA_TRUE; 1500 if (parent == obj) return EINA_TRUE;
1496 if (parent) 1501 if (parent)
1497 { 1502 {
1503 if (sd->parent_obj == sobj)
1504 {
1505 CRI("ATTEMPTING TO SET CHILD OF PARENT AS PARENT OF ITS OWN PARENT. THIS IS A BUG.");
1506 return EINA_FALSE;
1507 }
1508
1498 if (!efl_ui_widget_sub_object_del(parent, sobj)) 1509 if (!efl_ui_widget_sub_object_del(parent, sobj))
1499 return EINA_FALSE; 1510 return EINA_FALSE;
1500 } 1511 }