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.
This commit is contained in:
@@ -163,8 +163,17 @@ void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate)
|
|||||||
void BPY_text_free_code(Text *text)
|
void BPY_text_free_code(Text *text)
|
||||||
{
|
{
|
||||||
if (text->compiled) {
|
if (text->compiled) {
|
||||||
|
PyGILState_STATE gilstate;
|
||||||
|
int use_gil = !PYC_INTERPRETER_ACTIVE;
|
||||||
|
|
||||||
|
if (use_gil)
|
||||||
|
gilstate = PyGILState_Ensure();
|
||||||
|
|
||||||
Py_DECREF((PyObject *)text->compiled);
|
Py_DECREF((PyObject *)text->compiled);
|
||||||
text->compiled = NULL;
|
text->compiled = NULL;
|
||||||
|
|
||||||
|
if (use_gil)
|
||||||
|
PyGILState_Release(gilstate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user