Revision: 20419
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20419
Author: campbellbarton
Date: 2009-05-26 08:29:15 +0200 (Tue, 26 May 2009)
Log Message:
-----------
minor ref-counting changes, means new subclasses will get the correct ref count
though there are big problems with this still.
Found that subclassing an RNA struct (without even registering or instancing
adds a reference to Py_None).
Unlikely a python bug, tested with py2.6 and 3.1
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/python/intern/bpy_rna.c
Modified: branches/blender2.5/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- branches/blender2.5/blender/source/blender/python/intern/bpy_rna.c
2009-05-26 05:12:27 UTC (rev 20418)
+++ branches/blender2.5/blender/source/blender/python/intern/bpy_rna.c
2009-05-26 06:29:15 UTC (rev 20419)
@@ -1364,7 +1364,18 @@
{
PointerRNA ptr;
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
+
RNA_struct_py_type_set(srna, (void *)newclass); /* Store for later use
*/
/* Not 100% needed but useful,
@@ -1982,8 +1993,7 @@
BKE_reports_clear(&reports);
- pyrna_subtype_set_rna(py_class, srna);
- Py_INCREF(py_class);
+ pyrna_subtype_set_rna(py_class, srna); /* takes a ref to py_class */
Py_RETURN_NONE;
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs