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:
Diffstat (limited to 'source/blender/python/generic/mathutils.c')
-rw-r--r--source/blender/python/generic/mathutils.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c
index 1f802edcdea..7d56f1e0904 100644
--- a/source/blender/python/generic/mathutils.c
+++ b/source/blender/python/generic/mathutils.c
@@ -325,13 +325,30 @@ PyObject *BaseMathObject_getWrapped(BaseMathObject *self, void *UNUSED(closure))
return PyBool_FromLong((self->wrapped == Py_WRAP) ? 1:0);
}
-void BaseMathObject_dealloc(BaseMathObject * self)
+int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg)
+{
+ Py_VISIT(self->cb_user);
+ return 0;
+}
+
+int BaseMathObject_clear(BaseMathObject *self)
+{
+ Py_CLEAR(self->cb_user);
+ return 0;
+}
+
+void BaseMathObject_dealloc(BaseMathObject *self)
{
/* only free non wrapped */
- if(self->wrapped != Py_WRAP)
- PyMem_Free(self->data);
+ if(self->wrapped != Py_WRAP) {
+ /* the ONLY time this should be NULL is when the value failed to initialize */
+ if(self->data) {
+ PyMem_Free(self->data);
+ }
+ }
+
+ BaseMathObject_clear(self);
- Py_XDECREF(self->cb_user);
Py_TYPE(self)->tp_free(self); // PyObject_DEL(self); // breaks subtypes
}