derekf pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d14c700e9d41ce0db6ccb2bdc46fca56d3895b67
commit d14c700e9d41ce0db6ccb2bdc46fca56d3895b67 Author: Derek Foreman <derek.foreman.sams...@gmail.com> Date: Fri Jan 18 13:39:46 2019 -0600 efl_ui_widget: Save some pointer indirection We're getting the same widget data twice, as well as testing if the object is a widget twice. Let's do these things once. Signed-off-by: Derek Foreman <derek.foreman.sams...@gmail.com> Reviewed-by: Mike Blumenkrantz <michael.blumenkra...@gmail.com> Differential Revision: https://phab.enlightenment.org/D7698 --- src/lib/elementary/efl_ui_widget.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 415882af0d..30f1ba3c4a 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -1469,24 +1469,26 @@ EOLIAN static Eina_Bool _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) { Eina_Bool mirrored, pmirrored = efl_ui_mirrored_get(obj); + Elm_Widget_Smart_Data *sdc = NULL; EINA_SAFETY_ON_TRUE_RETURN_VAL(obj == sobj, EINA_FALSE); + if (_elm_widget_is(sobj)) + sdc = efl_data_scope_get(sobj, MY_CLASS); + if (sobj == sd->parent_obj) { /* in this case, sobj must be an elm widget, or something * very wrong is happening */ - if (!_elm_widget_is(sobj)) return EINA_FALSE; + if (!sdc) return EINA_FALSE; if (!elm_widget_sub_object_del(sobj, obj)) return EINA_FALSE; WRN("You passed a parent object of obj = %p as the sub object = %p!", obj, sobj); } - if (_elm_widget_is(sobj)) + if (sdc) { - ELM_WIDGET_DATA_GET(sobj, sdc); - if (sdc->parent_obj == obj) goto end; if (sdc->parent_obj) { @@ -1543,10 +1545,8 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob evas_object_data_set(sobj, "elm-parent", obj); _callbacks_add(sobj, obj); - if (_elm_widget_is(sobj)) + if (sdc) { - ELM_WIDGET_DATA_GET(sobj, sdc); - /* NOTE: In the following two lines, 'sobj' is correct. Do not change it. * Due to elementary's scale policy, scale and pscale can be different in * some cases. This happens when sobj's previous parent and new parent have --