[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35452] trunk/blender/source/blender/ editors/space_view3d/drawobject.c: Bugfix #26442

Ton Roosendaal ton at blender.org
Thu Mar 10 13:52:19 CET 2011


Revision: 35452
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35452
Author:   ton
Date:     2011-03-10 12:52:18 +0000 (Thu, 10 Mar 2011)
Log Message:
-----------
Bugfix #26442

Very bad crashing in using "Not AA fonts" and drawing length info
on EditMesh. This uses the call BLF_draw_ascii() which apparently
corruptes then badly. Disabled the call for now, and wait for fix.

In the course of testing, added proper strlen storage for draw
in this code.

Added strlen

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/drawobject.c

Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c	2011-03-10 12:36:11 UTC (rev 35451)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c	2011-03-10 12:52:18 UTC (rev 35452)
@@ -575,6 +575,7 @@
 	short mval[2];
 	short xoffs;
 	short flag;
+	int str_len, pad;
 	/* str is allocated past the end */
 } ViewCachedString;
 
@@ -596,6 +597,7 @@
 	vos->col.pack= *((int *)col);
 	vos->xoffs= xoffs;
 	vos->flag= flag;
+	vos->str_len= alloc_len-1;
 
 	/* allocate past the end */
 	memcpy(++vos, str, alloc_len);
@@ -661,10 +663,10 @@
 					col_pack_prev= vos->col.pack;
 				}
 				if(vos->flag & V3D_CACHE_TEXT_ASCII) {
-					BLF_draw_default_ascii((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, 65535); /* XXX, use real length */
+					BLF_draw_default((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, 65535); /* XXX, use real length */
+					BLF_draw_default((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len);
 				}
 			}
 		}




More information about the Bf-blender-cvs mailing list