Fix T42005: Reset py-handlers could crash
Wasn't acquiring the GIL.
This commit is contained in:
parent
e72d8b4711
commit
cf38b933f3
Notes:
blender-bot
2023-02-14 10:02:22 +01:00
Referenced by issue #42005, Lambda as scene_update_pre handler may crash Blender upon unload
|
@ -240,8 +240,11 @@ PyObject *BPY_app_handlers_struct(void)
|
|||
|
||||
void BPY_app_handlers_reset(const short do_all)
|
||||
{
|
||||
PyGILState_STATE gilstate;
|
||||
int pos = 0;
|
||||
|
||||
gilstate = PyGILState_Ensure();
|
||||
|
||||
if (do_all) {
|
||||
for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
|
||||
/* clear list */
|
||||
|
@ -279,6 +282,8 @@ void BPY_app_handlers_reset(const short do_all)
|
|||
|
||||
Py_DECREF(perm_id_str);
|
||||
}
|
||||
|
||||
PyGILState_Release(gilstate);
|
||||
}
|
||||
|
||||
/* the actual callback - not necessarily called from py */
|
||||
|
|
Loading…
Reference in New Issue