diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2008-02-25 04:35:50 +0300 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2008-02-25 04:35:50 +0300 |
commit | 18df3388a4dd111f34c20c7bd9a71ab7e7cbe9c0 (patch) | |
tree | 49adf9b82f1b3deea2e1ec8424085d729631b085 /source/blender/python/api2_2x/Draw.c | |
parent | ed7156a258e775de4ef891342de3b27a9c99afc4 (diff) |
== BPython ==
[#8354] Blender or Python25.dll crash on... quit, reported by David B. (myvain)
The BPy_FreeButtonsList() function is also called after we call Py_Finalize(). Calling PyGILState_Ensure()/Release() there crashes Blender. Added a test to prevent this, but note that function still runs Python API code to free a buttons list. Doesn't seem to give problems, though. Thanks, David.
Diffstat (limited to 'source/blender/python/api2_2x/Draw.c')
-rw-r--r-- | source/blender/python/api2_2x/Draw.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c index da8a87ad218..a5c14edc7aa 100644 --- a/source/blender/python/api2_2x/Draw.c +++ b/source/blender/python/api2_2x/Draw.c @@ -881,13 +881,16 @@ void BPy_Free_DrawButtonsList(void) { /*Clear the list.*/ if (M_Button_List) { - PyGILState_STATE gilstate = PyGILState_Ensure(); + PyGILState_STATE gilstate; + int py_is_on = Py_IsInitialized(); + + if (py_is_on) gilstate = PyGILState_Ensure(); PyList_SetSlice(M_Button_List, 0, PyList_Size(M_Button_List), NULL); Py_DECREF(M_Button_List); M_Button_List = NULL; - PyGILState_Release(gilstate); + if (py_is_on) PyGILState_Release(gilstate); } } |