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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-05-15 02:51:11 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-05-15 02:51:11 +0400
commit50c46fb9b3d1c6c423c0e6bf90a1bbc2e571c4bd (patch)
treea5309d7658605dfae9c46001c60496eedbee1e76 /source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
parent628bde206ff4bb35ecd6ff510211086c986dd9ed (diff)
Further fix for memory leaks in Freestyle Python API components:
- StrokeAttribute thickness setter - BezierCurve (used from within BezierCurveShader) - Smoother (used from within SmoothingShader)
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp')
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
index eb175eb7bca..e17f16a2fa7 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
+++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
@@ -526,13 +526,12 @@ static PyObject *StrokeAttribute_color_get(BPy_StrokeAttribute *self, void *UNUS
static int StrokeAttribute_color_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure))
{
- Vec3f *v = Vec3f_ptr_from_PyObject(value);
- if (!v) {
+ float v[3];
+ if (!float_array_from_PyObject(value, v, 3)) {
PyErr_SetString(PyExc_ValueError, "value must be a 3-dimensional vector");
return -1;
}
- self->sa->setColor(v->x(), v->y(), v->z());
- delete v;
+ self->sa->setColor(v[0], v[1], v[2]);
return 0;
}
@@ -551,12 +550,12 @@ static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void *
static int StrokeAttribute_thickness_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure))
{
- Vec2f *v = Vec2f_ptr_from_PyObject(value);
- if (!v) {
+ float v[2];
+ if (!float_array_from_PyObject(value, v, 2)) {
PyErr_SetString(PyExc_ValueError, "value must be a 2-dimensional vector");
return -1;
}
- self->sa->setThickness(v->x(), v->y());
+ self->sa->setThickness(v[0], v[1]);
return 0;
}