elm_entry: CRI if efl_file methods are called directly on this object

eo methods should not be called on legacy objects

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8487
This commit is contained in:
Mike Blumenkrantz 2019-03-27 11:25:28 -04:00 committed by Marcel Hollerbach
parent 9f1cd60aeb
commit 1240232863
2 changed files with 9 additions and 1 deletions

View File

@ -4987,7 +4987,9 @@ elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
if (sd->auto_save) _save_do(obj);
elm_obj_entry_file_text_format_set(obj, format);
sd->file_setting = EINA_TRUE;
ret = efl_file_simple_load(obj, file, NULL);
sd->file_setting = EINA_FALSE;
return ret;
}
@ -4999,10 +5001,13 @@ _elm_entry_efl_file_unload(Eo *obj, Elm_Entry_Data *sd EINA_UNUSED)
}
EOLIAN static Eina_Error
_elm_entry_efl_file_load(Eo *obj, Elm_Entry_Data *sd EINA_UNUSED)
_elm_entry_efl_file_load(Eo *obj, Elm_Entry_Data *sd)
{
Eina_Error err;
if (!sd->file_setting)
CRI("EO methods should not be used directly on legacy objects!");
if (efl_file_loaded_get(obj)) return 0;
err = efl_file_load(efl_super(obj, MY_CLASS));
if (err) return err;
@ -5012,6 +5017,8 @@ _elm_entry_efl_file_load(Eo *obj, Elm_Entry_Data *sd EINA_UNUSED)
EOLIAN static Eina_Error
_elm_entry_efl_file_file_set(Eo *obj, Elm_Entry_Data *sd, const char *file)
{
if (!sd->file_setting)
CRI("EO methods should not be used directly on legacy objects!");
eina_stringshare_replace(&sd->file, file);
return efl_file_set(efl_super(obj, MY_CLASS), file);
}

View File

@ -116,6 +116,7 @@ struct _Elm_Entry_Data
Eina_Bool changed : 1;
Eina_Bool scroll : 1;
Eina_Bool input_panel_show_on_demand : 1;
Eina_Bool file_setting : 1;
};
typedef struct _Elm_Entry_Item_Provider Elm_Entry_Item_Provider;