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 Eagar <joeedh@gmail.com>2007-01-31 01:38:43 +0300
committerJoseph Eagar <joeedh@gmail.com>2007-01-31 01:38:43 +0300
commit3ab085a5b6bafe4e6a43c594f4c6dda9d9be17d7 (patch)
tree3cd2a875eadadff3c28207ba00a0308e7d24db53 /source/blender/python/api2_2x/Armature.c
parent3be758d1dbd100f98744258bc27a97eec5776b4e (diff)
=Python bugfix=
Armature code had missing NULL pointer check that crashed when used in pydrivers.
Diffstat (limited to 'source/blender/python/api2_2x/Armature.c')
-rw-r--r--source/blender/python/api2_2x/Armature.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c
index bb711ba49d9..658a06d4207 100644
--- a/source/blender/python/api2_2x/Armature.c
+++ b/source/blender/python/api2_2x/Armature.c
@@ -1351,12 +1351,12 @@ PyObject *PyArmature_FromArmature(struct bArmature *armature)
PyObject *maindict = NULL, *armdict = NULL, *weakref = NULL;
//create armature type
- py_armature = (BPy_Armature*)Armature_Type.tp_alloc(&Armature_Type, 0); //*new*
+ py_armature = (BPy_Armature*)PyObject_New(BPy_Armature, &Armature_Type); //Armature_Type.tp_alloc(&Armature_Type, 0); //*new*
py_armature->weaklist = NULL; //init the weaklist
if (!py_armature)
goto RuntimeError;
py_armature->armature = armature;
-
+
//create armature.bones
py_armature->Bones = (BPy_BonesDict*)PyBonesDict_FromPyArmature(py_armature);
if (!py_armature->Bones)
@@ -1364,13 +1364,21 @@ PyObject *PyArmature_FromArmature(struct bArmature *armature)
//put a weakreference in __main__
maindict= PyModule_GetDict(PyImport_AddModule( "__main__"));
+
armdict = PyDict_GetItemString(maindict, "armatures");
+ /*armature list doesn't exist for pydrivers. . .so check.
+ by the way, why is the var called armatures? what if a script author has
+ a similar var in his script? won't they conflict?.
+
+ joeedh*/
+ if (!armdict) return (PyObject *) py_armature;
+
weakref = PyWeakref_NewProxy((PyObject*)py_armature, Py_None);
if (PyList_Append(armdict, weakref) == -1){
goto RuntimeError;
}
- return (PyObject *) py_armature;
+ return (PyObject *) py_armature;
RuntimeError:
return EXPP_objError(PyExc_RuntimeError, "%s%s%s",