Evas textblock: Fix seg with empty textblocks that cause wrapping.
authorTom Hacohen <tom@stosb.com>
Fri, 6 May 2011 10:00:21 +0000 (10:00 +0000)
committerTom Hacohen <tom@stosb.com>
Fri, 6 May 2011 10:00:21 +0000 (10:00 +0000)
Revert "evas: don't assume anymore that text_node is != NULL."
This reverts commit 59231

Thanks to cedric for the report + initial fix.

SVN revision: 59237

legacy/evas/src/lib/canvas/evas_object_textblock.c

index 08535ca..b688c42 100644 (file)
@@ -3162,7 +3162,6 @@ _layout_get_wordwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
       const Evas_Object_Textblock_Text_Item *ti, size_t line_start,
       const char *breaks)
 {
-   if (!ti->parent.text_node) return -1;
    return _layout_get_word_mixwrap_common(c, fmt, ti, EINA_FALSE, line_start,
          breaks);
 }
@@ -3173,7 +3172,6 @@ _layout_get_mixedwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
       const Evas_Object_Textblock_Text_Item *ti, size_t line_start,
       const char *breaks)
 {
-   if (!ti->parent.text_node) return -1;
    return _layout_get_word_mixwrap_common(c, fmt, ti, EINA_TRUE, line_start,
          breaks);
 }
@@ -3381,8 +3379,10 @@ _layout_visualize_par(Ctxt *c)
                   ret = 1;
                   goto end;
                }
-             else if (it->format->wrap_word || it->format->wrap_char ||
-                it->format->wrap_mixed)
+             /* If we want to wrap and it's worth checking for wrapping
+              * (i.e there's actually text). */
+             else if ((it->format->wrap_word || it->format->wrap_char ||
+                it->format->wrap_mixed) && it->text_node)
                {
                   if (it->type == EVAS_TEXTBLOCK_ITEM_FORMAT)
                     {
@@ -3405,7 +3405,7 @@ _layout_visualize_par(Ctxt *c)
                        if (!line_breaks)
                          {
                             /* Only relevant in those cases */
-                            if ((it->format->wrap_word || it->format->wrap_mixed) && it->text_node)
+                            if (it->format->wrap_word || it->format->wrap_mixed)
                               {
                                  size_t len =
                                     eina_ustrbuf_length_get(