From 2088153dc6021aad8912a7a22b0b1b6911bf3b3c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 27 Mar 2019 11:25:28 -0400 Subject: [PATCH] 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 Differential Revision: https://phab.enlightenment.org/D8487 --- src/lib/elementary/elm_entry.c | 9 ++++++++- src/lib/elementary/elm_widget_entry.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index 96f004b..500757d 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -6656,7 +6656,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; } @@ -6668,10 +6670,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; @@ -6681,6 +6686,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); } diff --git a/src/lib/elementary/elm_widget_entry.h b/src/lib/elementary/elm_widget_entry.h index a274078..0d540d2 100644 --- a/src/lib/elementary/elm_widget_entry.h +++ b/src/lib/elementary/elm_widget_entry.h @@ -148,6 +148,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; -- 2.7.4