[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35912] trunk/blender/source/blender/ python/intern/bpy_rna.c: fix for crash when running blender with define WITH_PYTHON_SAFETY & no startup .blend was found.
Campbell Barton
ideasman42 at gmail.com
Thu Mar 31 06:43:26 CEST 2011
Revision: 35912
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35912
Author: campbellbarton
Date: 2011-03-31 04:43:26 +0000 (Thu, 31 Mar 2011)
Log Message:
-----------
fix for crash when running blender with define WITH_PYTHON_SAFETY & no startup.blend was found.
was calling python function when python was not initialized.
Modified Paths:
--------------
trunk/blender/source/blender/python/intern/bpy_rna.c
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2011-03-31 01:37:42 UTC (rev 35911)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2011-03-31 04:43:26 UTC (rev 35912)
@@ -225,18 +225,18 @@
BLI_ghashIterator_init(&weakinfo_hash_iter, weakinfo_hash);
- #ifdef DEBUG_RNA_WEAKREF
+#ifdef DEBUG_RNA_WEAKREF
fprintf(stdout, "id_release_weakref: '%s', %d items\n", id->name, BLI_ghash_size(weakinfo_hash));
- #endif
+#endif
while (!BLI_ghashIterator_isDone(&weakinfo_hash_iter)) {
PyObject *weakref= (PyObject *)BLI_ghashIterator_getKey(&weakinfo_hash_iter);
PyObject *item= PyWeakref_GET_OBJECT(weakref);
if(item != Py_None) {
- #ifdef DEBUG_RNA_WEAKREF
+#ifdef DEBUG_RNA_WEAKREF
PyC_ObSpit("id_release_weakref item ", item);
- #endif
+#endif
pyrna_invalidate((BPy_DummyPointerRNA *)item);
}
@@ -252,9 +252,9 @@
if(BLI_ghash_size(id_weakref_pool) == 0) {
BLI_ghash_free(id_weakref_pool, NULL, NULL);
id_weakref_pool= NULL;
- #ifdef DEBUG_RNA_WEAKREF
+#ifdef DEBUG_RNA_WEAKREF
printf("id_release_weakref freeing pool\n");
- #endif
+#endif
}
}
@@ -275,11 +275,13 @@
#endif
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
- PyGILState_STATE gilstate= PyGILState_Ensure();
+ if(id_weakref_pool) {
+ PyGILState_STATE gilstate= PyGILState_Ensure();
- id_release_weakref(id);
+ id_release_weakref(id);
- PyGILState_Release(gilstate);
+ PyGILState_Release(gilstate);
+ }
#endif /* USE_PYRNA_INVALIDATE_WEAKREF */
(void)id;
More information about the Bf-blender-cvs
mailing list