[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14333] trunk/blender: PyAPI - setting a buttons string value crashed.

Campbell Barton ideasman42 at gmail.com
Sat Apr 5 01:12:22 CEST 2008


Revision: 14333
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14333
Author:   campbellbarton
Date:     2008-04-05 01:12:20 +0200 (Sat, 05 Apr 2008)

Log Message:
-----------
PyAPI - setting a buttons string value crashed. suspect this is a 64bit problem since replacing the string length of int, with Py_ssize_t or long prevented the crash. worked around the problem by removing the PyString_AsStringAndSize command.

wizard_curve2tree - removing id properties didnt work. exit button used a callback it didnt need to.

Modified Paths:
--------------
    trunk/blender/release/scripts/wizard_curve2tree.py
    trunk/blender/source/blender/python/api2_2x/Draw.c

Modified: trunk/blender/release/scripts/wizard_curve2tree.py
===================================================================
--- trunk/blender/release/scripts/wizard_curve2tree.py	2008-04-04 22:21:24 UTC (rev 14332)
+++ trunk/blender/release/scripts/wizard_curve2tree.py	2008-04-04 23:12:20 UTC (rev 14333)
@@ -3537,7 +3537,7 @@
 		return
 	
 	for ob in objects:
-		try:	del idprop[ID_SLOT_NAME]
+		try:	del ob.properties[ID_SLOT_NAME]
 		except:	pass
 
 def do_tex_check(e,v):
@@ -3989,7 +3989,7 @@
 	# ---------- ---------- ---------- ----------
 	
 	Blender.Draw.BeginAlign()
-	Draw.PushButton('Exit',	EVENT_EXIT, xtmp, y, but_width, but_height,	'', do_active_image); xtmp += but_width;
+	Draw.PushButton('Exit',	EVENT_EXIT, xtmp, y, but_width, but_height,	''); xtmp += but_width;
 	Draw.PushButton('Generate from selection',	EVENT_REDRAW, xtmp, y, but_width*3, but_height,	'Generate mesh', do_tree_generate); xtmp += but_width*3;
 	Blender.Draw.EndAlign()
 	y-=but_height+MARGIN

Modified: trunk/blender/source/blender/python/api2_2x/Draw.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Draw.c	2008-04-04 22:21:24 UTC (rev 14332)
+++ trunk/blender/source/blender/python/api2_2x/Draw.c	2008-04-04 23:12:20 UTC (rev 14333)
@@ -532,10 +532,8 @@
 				return 0;
 		}
 		else if( but->type == BSTRING_TYPE && PyString_Check(v) ) {
-			char *newstr;
-			unsigned int newlen;
-
-			PyString_AsStringAndSize( v, &newstr, (int *)&newlen );
+			char *newstr = PyString_AsString(v);
+			int newlen = strlen(newstr);
 			
 			if (newlen+1> UI_MAX_DRAW_STR)
 				return EXPP_ReturnIntError( PyExc_ValueError, "Error: button string length exceeded max limit (399 chars).");





More information about the Bf-blender-cvs mailing list