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
diff options
context:
space:
mode:
-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;