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:
authorJoseph Gilbert <ascotan@gmail.com>2005-07-19 22:47:25 +0400
committerJoseph Gilbert <ascotan@gmail.com>2005-07-19 22:47:25 +0400
commit2801c8b20afdd4cf4f2157d65132f46082693318 (patch)
treecf21fd2c38af5d489ce16045b2d6b10bd4f12e34 /source/blender/python/api2_2x/vector.c
parent19abd72baaf2de95c5f46011708756f2ca9dcd8d (diff)
__ bug fix__
- internal methods for mathutils class need to incref before returning a pointer to self * memory allocation errors (freeing bad pointers) were appearing after repeatedly calling internal methods on the same object due to ref counts.
Diffstat (limited to 'source/blender/python/api2_2x/vector.c')
-rw-r--r--source/blender/python/api2_2x/vector.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/python/api2_2x/vector.c b/source/blender/python/api2_2x/vector.c
index 6e5235f2a7e..f6bfa1e7c5b 100644
--- a/source/blender/python/api2_2x/vector.c
+++ b/source/blender/python/api2_2x/vector.c
@@ -61,7 +61,7 @@ PyObject *Vector_Zero(VectorObject * self)
for(x = 0; x < self->size; x++) {
self->vec[x] = 0.0f;
}
- return (PyObject*)self;
+ return EXPP_incr_ret((PyObject*)self);
}
//----------------------------Vector.normalize() -----------------
//normalize the vector data to a unit vector
@@ -77,7 +77,7 @@ PyObject *Vector_Normalize(VectorObject * self)
for(x = 0; x < self->size; x++) {
self->vec[x] /= norm;
}
- return (PyObject*)self;
+ return EXPP_incr_ret((PyObject*)self);
}
//----------------------------Vector.negate() --------------------
//set the vector to it's negative -x, -y, -z
@@ -87,7 +87,7 @@ PyObject *Vector_Negate(VectorObject * self)
for(x = 0; x < self->size; x++) {
self->vec[x] = -(self->vec[x]);
}
- return (PyObject*)self;
+ return EXPP_incr_ret((PyObject*)self);
}
//----------------------------Vector.resize2D() ------------------
//resize the vector to x,y
@@ -106,7 +106,7 @@ PyObject *Vector_Resize2D(VectorObject * self)
}
self->vec = self->data.py_data; //force
self->size = 2;
- return (PyObject*)self;
+ return EXPP_incr_ret((PyObject*)self);
}
//----------------------------Vector.resize3D() ------------------
//resize the vector to x,y,z
@@ -128,7 +128,7 @@ PyObject *Vector_Resize3D(VectorObject * self)
self->data.py_data[2] = 0.0f;
}
self->size = 3;
- return (PyObject*)self;
+ return EXPP_incr_ret((PyObject*)self);
}
//----------------------------Vector.resize4D() ------------------
//resize the vector to x,y,z,w
@@ -153,7 +153,7 @@ PyObject *Vector_Resize4D(VectorObject * self)
self->data.py_data[3] = 0.0f;
}
self->size = 4;
- return (PyObject*)self;
+ return EXPP_incr_ret((PyObject*)self);
}
//----------------------------dealloc()(internal) ----------------
//free the py_object