diff options
author | Joseph Gilbert <ascotan@gmail.com> | 2005-07-19 22:47:25 +0400 |
---|---|---|
committer | Joseph Gilbert <ascotan@gmail.com> | 2005-07-19 22:47:25 +0400 |
commit | 2801c8b20afdd4cf4f2157d65132f46082693318 (patch) | |
tree | cf21fd2c38af5d489ce16045b2d6b10bd4f12e34 /source/blender/python/api2_2x/quat.c | |
parent | 19abd72baaf2de95c5f46011708756f2ca9dcd8d (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/quat.c')
-rw-r--r-- | source/blender/python/api2_2x/quat.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/python/api2_2x/quat.c b/source/blender/python/api2_2x/quat.c index d16de9d5785..ed6123ce7a3 100644 --- a/source/blender/python/api2_2x/quat.c +++ b/source/blender/python/api2_2x/quat.c @@ -90,7 +90,7 @@ PyObject *Quaternion_ToMatrix(QuaternionObject * self) PyObject *Quaternion_Normalize(QuaternionObject * self) { NormalQuat(self->quat); - return (PyObject*)self; + return EXPP_incr_ret((PyObject*)self); } //----------------------------Quaternion.inverse()------------------ //invert the quat @@ -110,7 +110,7 @@ PyObject *Quaternion_Inverse(QuaternionObject * self) self->quat[x] /= (float)(mag * mag); } - return (PyObject*)self; + return EXPP_incr_ret((PyObject*)self); } //----------------------------Quaternion.identity()----------------- //generate the identity quaternion @@ -121,7 +121,7 @@ PyObject *Quaternion_Identity(QuaternionObject * self) self->quat[2] = 0.0; self->quat[3] = 0.0; - return (PyObject*)self; + return EXPP_incr_ret((PyObject*)self); } //----------------------------Quaternion.negate()------------------- //negate the quat @@ -131,7 +131,7 @@ PyObject *Quaternion_Negate(QuaternionObject * self) for(x = 0; x < 4; x++) { self->quat[x] = -self->quat[x]; } - return (PyObject*)self; + return EXPP_incr_ret((PyObject*)self); } //----------------------------Quaternion.conjugate()---------------- //negate the vector part @@ -141,7 +141,7 @@ PyObject *Quaternion_Conjugate(QuaternionObject * self) for(x = 1; x < 4; x++) { self->quat[x] = -self->quat[x]; } - return (PyObject*)self; + return EXPP_incr_ret((PyObject*)self); } //----------------------------dealloc()(internal) ------------------ //free the py_object |