tasn pushed a commit to branch master.

commit fdbc477f7990f78f69144a26d5990e35057b3317
Author: Tom Hacohen <[email protected]>
Date:   Tue Jun 25 16:37:48 2013 +0100

    Evas textblock: Fixed issue with textblocks without fonts segfaulting.
    
    Fixes T184 (which is a regression).
---
 ChangeLog                                   | 5 +++++
 NEWS                                        | 2 +-
 src/lib/evas/canvas/evas_object_textblock.c | 5 +++++
 src/tests/evas/evas_test_textblock.c        | 7 +++++++
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 38c2abe..ce224f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-25  Tom Hacohen
+
+       * Evas textblock: Fixed issue with textblocks without fonts
+       segfaulting.
+
 2013-06-24  Cedric Bail
 
        * Evas: add support for asynchronously uploading GL texture.
diff --git a/NEWS b/NEWS
index 228e527..f5afb22 100644
--- a/NEWS
+++ b/NEWS
@@ -339,4 +339,4 @@ Fixes:
     * Evas: Fix gif cannot decode alpha value correctly.
     * Evas: Fix bs if app call image object update add after call api like 
fileset.
     * Evas: Fix evas_gl direct rendering to support partial redraw.
-
+    * Evas textblock: Fixed issue with textblocks without fonts segfaulting.
diff --git a/src/lib/evas/canvas/evas_object_textblock.c 
b/src/lib/evas/canvas/evas_object_textblock.c
index 4ac813d..88d1fa4 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -2550,6 +2550,11 @@ _layout_item_ascent_descent_adjust(const Evas_Object 
*eo_obj,
       Evas_Coord *maxascent, Evas_Coord *maxdescent,
       Evas_Object_Textblock_Item *it, Textblock_Position position)
 {
+   if (!it->format || !it->format->font.font)
+     {
+        return;
+     }
+
    _layout_format_ascent_descent_adjust(eo_obj, maxascent, maxdescent, 
it->format);
 
    if ((it->type == EVAS_TEXTBLOCK_ITEM_TEXT) &&
diff --git a/src/tests/evas/evas_test_textblock.c 
b/src/tests/evas/evas_test_textblock.c
index ca6644d..03332b4 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -2484,6 +2484,13 @@ START_TEST(evas_textblock_style)
    evas_object_textblock_style_insets_get(tb, &l, &r, &t, &b);
    fail_if((l != 1) || (r != 4) || (t != 1) || (b != 4));
 
+   /* No font */
+   evas_textblock_style_set(newst, "DEFAULT=''");
+   evas_object_textblock_text_markup_set(tb, "Test");
+   evas_object_textblock_size_formatted_get(tb, &nw, &nh);
+   ck_assert_int_eq(nw, 0);
+   ck_assert_int_eq(nw, nh);
+
    END_TB_TEST();
 }
 END_TEST

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to