From a3808761cc44e0f35a6bcffc6c46ac3064ec19a2 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 21 Feb 2011 06:12:28 +0000 Subject: [PATCH] fix bug with prev/cur text state access in text obj for utf8 string. SVN revision: 57201 --- legacy/evas/ChangeLog | 6 ++++++ legacy/evas/src/lib/canvas/evas_object_text.c | 18 +++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/legacy/evas/ChangeLog b/legacy/evas/ChangeLog index f85b45b36f..756ecddee3 100644 --- a/legacy/evas/ChangeLog +++ b/legacy/evas/ChangeLog @@ -110,3 +110,9 @@ * Fix bug in font string parsing that can result in a crash if a font element is long enough. * Fiix convert rgba8888 -> a8 bug so it wont crash. + +2011-02-21 Carsten Haitzler (The Rasterman) + + * Fixed bug with memory access of old utf8 string when + comparing prev and cur state with text obj. + diff --git a/legacy/evas/src/lib/canvas/evas_object_text.c b/legacy/evas/src/lib/canvas/evas_object_text.c index 505cea5463..73d03b6e38 100644 --- a/legacy/evas/src/lib/canvas/evas_object_text.c +++ b/legacy/evas/src/lib/canvas/evas_object_text.c @@ -673,11 +673,8 @@ evas_object_text_text_set(Evas_Object *obj, const char *_text) return; MAGIC_CHECK_END(); - if ((o->cur.utf8_text) && (_text) && - (!strcmp(o->cur.utf8_text, _text))) - { - return; - } + if ((o->cur.utf8_text) && (_text) && (!strcmp(o->cur.utf8_text, _text))) + return; text = eina_unicode_utf8_to_unicode(_text, &len); if (!text) text = eina_unicode_strdup(EINA_UNICODE_EMPTY_STRING); @@ -693,6 +690,7 @@ evas_object_text_text_set(Evas_Object *obj, const char *_text) { _evas_object_text_layout(obj, o, text); eina_stringshare_replace(&o->cur.utf8_text, _text); + o->prev.utf8_text = NULL; } else { @@ -2138,14 +2136,8 @@ evas_object_text_render_pre(Evas_Object *obj) if (o->changed) { if ((o->cur.size != o->prev.size) || - ((o->cur.font) && (o->prev.font) && - (strcmp(o->cur.font, o->prev.font))) || - ((o->cur.font) && (!o->prev.font)) || - ((!o->cur.font) && (o->prev.font)) || - ((o->cur.utf8_text) && (o->prev.utf8_text) && - (strcmp(o->cur.utf8_text, o->prev.utf8_text))) || - ((o->cur.utf8_text) && (!o->prev.utf8_text)) || - ((!o->cur.utf8_text) && (o->prev.utf8_text)) || + ((o->cur.font != o->prev.font)) || + ((o->cur.utf8_text != o->prev.utf8_text)) || ((o->cur.style != o->prev.style)) || ((o->cur.shadow.r != o->prev.shadow.r)) || ((o->cur.shadow.g != o->prev.shadow.g)) ||