fix [#26442] blender crash when turning off antialiasing fonts
authorCampbell Barton <ideasman42@gmail.com>
Thu, 10 Mar 2011 13:49:46 +0000 (13:49 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 10 Mar 2011 13:49:46 +0000 (13:49 +0000)
ASCII lookup table wasn't being freed when when the rest of the glyphs were.

Also found own bug where mesh stat text was using wrong sized array (char[3] as char[4]).

source/blender/blenfont/intern/blf_glyph.c
source/blender/editors/space_view3d/drawobject.c

index b9154951fb129ddfcef8973edee1a3bebbb60f1f..e165012f43e2c304dde9b7c309430b77b3e92cbf 100644 (file)
@@ -135,6 +135,8 @@ void blf_glyph_cache_clear(FontBLF *font)
                        }
                }
        }
+
+       memset(font->glyph_ascii_table, 0, sizeof(font->glyph_ascii_table));
 }
 
 void blf_glyph_cache_free(GlyphCacheBLF *gc)
index bb298756927cdbaad7f809250b3c15bbd39f1bb7..bd3c140c64721236d19c14f47c24fb92307befd2 100644 (file)
@@ -663,7 +663,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
                                        col_pack_prev= vos->col.pack;
                                }
                                if(vos->flag & V3D_CACHE_TEXT_ASCII) {
-                                       BLF_draw_default((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len);
+                                       BLF_draw_default_ascii((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len);
                                }
                                else {
                                        BLF_draw_default((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len);
@@ -2123,7 +2123,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
        float fvec[3];
        char val[32]; /* Stores the measurement display text here */
        const char *conv_float; /* Use a float conversion matching the grid size */
-       unsigned char col[3]; /* color of the text to draw */
+       unsigned char col[4]= {0, 0, 0, 255}; /* color of the text to draw */
        float area; /* area of the face */
        float grid= unit->system ? unit->scale_length : v3d->grid;
        const int do_split= unit->flag & USER_UNIT_OPT_SPLIT;