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:
authorCampbell Barton <ideasman42@gmail.com>2012-09-11 03:32:46 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-11 03:32:46 +0400
commitcf5da37e3c4c8ed4bf5e0427d06b0e5c55f2059c (patch)
tree9a830d6fbeb3a30e339d59c2bc561b527800045e /source/blender/python/intern/bpy_interface.c
parent16e48ff9580fcaf0da46e9044ee0d6e10ccb662e (diff)
fix for a bug running a script, then opening a new file.
BPY_text_free_code() could run outside the python interpreter which abort()'s blender.
Diffstat (limited to 'source/blender/python/intern/bpy_interface.c')
-rw-r--r--source/blender/python/intern/bpy_interface.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 1c63ab512f2..9cd0bdd090a 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -163,8 +163,17 @@ void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate)
void BPY_text_free_code(Text *text)
{
if (text->compiled) {
+ PyGILState_STATE gilstate;
+ int use_gil = !PYC_INTERPRETER_ACTIVE;
+
+ if (use_gil)
+ gilstate = PyGILState_Ensure();
+
Py_DECREF((PyObject *)text->compiled);
text->compiled = NULL;
+
+ if (use_gil)
+ PyGILState_Release(gilstate);
}
}