fix bug with prev/cur text state access in text obj for utf8 string.
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 21 Feb 2011 06:12:28 +0000 (06:12 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 21 Feb 2011 06:12:28 +0000 (06:12 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@57201 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/canvas/evas_object_text.c

index f85b45b..756ecdd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
         * 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.
+
index 505cea5..73d03b6 100644 (file)
@@ -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)) ||