diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-05-28 06:03:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-05-28 06:03:48 +0400 |
commit | a804ae7b3f9a6c220bed51b91f7fdb0f3347e3e4 (patch) | |
tree | 87ec71bfe86b26f928ee3314c887d886c17f8ae8 /source/blender/python | |
parent | 4512be4b6cce1333c875380b67695e410e9f58c3 (diff) |
rna_define.c, RNA_def_struct - set the py_type to NULL when making an rna struct based on another.
bpy_util.c, PyObSpit - print refcount with PyObject
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 16 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_util.c | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index ded39482bc7..6080a2056a0 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1366,15 +1366,11 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna) PyObject *item; Py_INCREF(newclass); - - /* Something fishy is going on here, the pointer is set many times but never free'd - * It also is almost always the same type so it looks like the same point is - * being reused when it should not be - must look into this further */ -#if 0 + if (RNA_struct_py_type_get(srna)) - PyObSpit("RNA WAS SET - ", RNA_struct_py_type_get(srna)); - Py_XDECREF(RNA_struct_py_type_get(srna)); // TODO - why does this crash??? -#endif + PyObSpit("RNA WAS SET - ", RNA_struct_py_type_get(srna)); + + Py_XDECREF(RNA_struct_py_type_get(srna)); RNA_struct_py_type_set(srna, (void *)newclass); /* Store for later use */ @@ -1930,6 +1926,10 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par static void bpy_class_free(void *pyob_ptr) { + if(G.f&G_DEBUG) { + if(((PyObject *)pyob_ptr)->ob_refcnt > 1) + PyObSpit("zombie class - ref should be 1", (PyObject *)pyob_ptr); + } Py_DECREF((PyObject *)pyob_ptr); } diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c index 8fcade0911d..c447e7de982 100644 --- a/source/blender/python/intern/bpy_util.c +++ b/source/blender/python/intern/bpy_util.c @@ -166,6 +166,8 @@ void PyObSpit(char *name, PyObject *var) { } else { PyObject_Print(var, stderr, 0); + fprintf(stderr, " ref:%d ", var->ob_refcnt); + fprintf(stderr, " ptr:%ld", (long)var); } fprintf(stderr, "\n"); } |