Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorWillian Padovani Germano <wpgermano@gmail.com>2006-06-27 21:51:11 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2006-06-27 21:51:11 +0400
commit816ed68db5203bf2e891681739d563bbd98d267b (patch)
tree04f5f12bd3d0dadeab6dd2886bbd6afac2279199 /source
parente9c1e40681c61a26603541f7462f33432b02b135 (diff)
BPython:
Bug #4484: http://projects.blender.org/tracker/?func=detail&aid=4484&group_id=9&atid=125 A recent update to Draw.c made the button attr setter function not exit where it should for one of the cases, when new and old strings had same length (code was missing a "return 0;" line in one of the if cases). Should work fine now, I don't get the error under linux anymore. Also saw in the same function that a py object could be created but was not being decref'ed in two other 'if' cases. Thanks elbarto for reporting the bug.
Diffstat (limited to 'source')
-rw-r--r--source/blender/python/api2_2x/Draw.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c
index ad26235a477..d2a1331d4eb 100644
--- a/source/blender/python/api2_2x/Draw.c
+++ b/source/blender/python/api2_2x/Draw.c
@@ -406,6 +406,7 @@ static int Button_setattr( PyObject * self, char *name, PyObject * v )
PyObject *pyVal = PyNumber_Int( v );
if (pyVal) {
but->val.asint = (int)PyInt_AS_LONG( pyVal );
+ Py_DECREF(pyVal);
return 0;
}
}
@@ -413,6 +414,7 @@ static int Button_setattr( PyObject * self, char *name, PyObject * v )
PyObject *pyVal = PyNumber_Float( v );
if (pyVal) {
but->val.asfloat = (float)PyFloat_AS_DOUBLE( pyVal );
+ Py_DECREF(pyVal);
return 0;
}
}
@@ -427,13 +429,16 @@ static int Button_setattr( PyObject * self, char *name, PyObject * v )
PyString_AsStringAndSize( v, &newstr, &newlen );
if (newlen+1> UI_MAX_DRAW_STR)
- return EXPP_ReturnIntError( PyExc_ValueError, "Error, the string assigned to this button has a length greator then 399");
-
+ return EXPP_ReturnIntError( PyExc_ValueError, "Error: button string length exceeded max limit (399 chars).");
+
/* if the length of the new string is the same as */
/* the old one, just copy, else delete and realloc. */
if( but->slen == newlen ) {
BLI_strncpy( but->val.asstr, newstr,
but->slen + 1 );
+
+ return 0;
+
} else {
MEM_freeN( but->val.asstr );
but->slen = newlen;