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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-31 08:43:26 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-03-31 08:43:26 +0400
commit66a1259153100aeebb4319ed50f517d7266f780d (patch)
tree02da0a0dccc2c3e11b59a180c720192c1ada5863 /source
parent077f8520dae0425a481cbe82a3bcba902b93a0b0 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/python/intern/bpy_rna.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 9a459063d42..29f05369f44 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -225,18 +225,18 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
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 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
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 @@ void BPY_id_release(struct ID *id)
#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;