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:
-rw-r--r--source/blender/makesrna/intern/rna_define.c3
-rw-r--r--source/blender/python/intern/bpy_rna.c16
-rw-r--r--source/blender/python/intern/bpy_util.c2
3 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index a29f6c06b17..f216d8b3da6 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -559,6 +559,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
memcpy(srna, srnafrom, sizeof(StructRNA));
srna->cont.properties.first= srna->cont.properties.last= NULL;
srna->functions.first= srna->functions.last= NULL;
+ srna->py_type= NULL;
if(DefRNA.preprocess) {
srna->base= srnafrom;
@@ -567,7 +568,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
else
srna->base= srnafrom;
}
-
+
srna->identifier= identifier;
srna->name= identifier; /* may be overwritten later RNA_def_struct_ui_text */
srna->description= "";
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");
}