efl_ui_widget: secure elm_legacy_add flag

Summary:
_elm_legacy_add goes back to EINA_FALSE after setting sd->legacy.
if constructor get called again after going back to EINA_FALSE,
sd->legacy should remain EINA_TRUE.
also, elm_legacy_add() should not be called non-elm_widget.

Test Plan:
Run elementary test->Efl.Ui.Text.Label.
Check legacy flag in _elm_theme_object_set() for efl_ui_win.
Check legacy flag for efl_ui_text after scrollable text is added.

Reviewers: jpeg, woohyun

Reviewed By: jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5529
This commit is contained in:
Sungtaek Hong 2017-11-24 14:32:36 +09:00 committed by Jean-Philippe Andre
parent 56abebf236
commit 8f2369c5b6
2 changed files with 6 additions and 3 deletions

View File

@ -192,7 +192,7 @@ _elm_pan_content_size_get(Eo *obj EINA_UNUSED, Elm_Pan_Smart_Data *psd, Evas_Coo
static Evas_Object *
_elm_pan_add(Evas *evas)
{
return elm_legacy_add(MY_PAN_CLASS, evas);
return efl_add(MY_PAN_CLASS, evas, efl_canvas_object_legacy_ctor(efl_added));
}
EOLIAN static Eo *

View File

@ -5046,8 +5046,11 @@ _elm_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSE
Eo *parent = NULL;
sd->on_create = EINA_TRUE;
sd->legacy = _elm_legacy_add;
_elm_legacy_add = EINA_FALSE;
if (_elm_legacy_add)
{
sd->legacy = _elm_legacy_add;
_elm_legacy_add = EINA_FALSE;
}
efl_canvas_group_clipped_set(obj, EINA_FALSE);
obj = efl_constructor(efl_super(obj, MY_CLASS));
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);