From a60ce4e74f41f90a2eaab2c4e1878e9b5594fe85 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Fri, 13 Nov 2009 18:53:34 +0000 Subject: [PATCH] elm_entry: play nice with stringshare. This avoids removing entries from cache to just add them later if it was the last reference count. SVN revision: 43674 --- legacy/elementary/src/lib/elm_entry.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/legacy/elementary/src/lib/elm_entry.c b/legacy/elementary/src/lib/elm_entry.c index becd120fa9..7ced86f9ec 100644 --- a/legacy/elementary/src/lib/elm_entry.c +++ b/legacy/elementary/src/lib/elm_entry.c @@ -1156,15 +1156,17 @@ EAPI const char * elm_entry_entry_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); - const char *text; + const char *text, *s; if (!wd) return NULL; // Strip ending
that is added by the textblock // need to check if
is present? seems it is always there - if (wd->stripped) eina_stringshare_del(wd->stripped); text = edje_object_part_text_get(wd->ent, "elm.text"); - wd->stripped = eina_stringshare_add_length(text, strlen(text) - 4); - return wd->stripped; + s = eina_stringshare_add_length(text, strlen(text) - 4); + + if (wd->stripped) eina_stringshare_del(wd->stripped); + wd->stripped = s; + return s; } EAPI const char *