Fix T42005: Reset py-handlers could crash
Wasn't acquiring the GIL.
This commit is contained in:
@@ -240,8 +240,11 @@ PyObject *BPY_app_handlers_struct(void)
|
|||||||
|
|
||||||
void BPY_app_handlers_reset(const short do_all)
|
void BPY_app_handlers_reset(const short do_all)
|
||||||
{
|
{
|
||||||
|
PyGILState_STATE gilstate;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
|
gilstate = PyGILState_Ensure();
|
||||||
|
|
||||||
if (do_all) {
|
if (do_all) {
|
||||||
for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
|
for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
|
||||||
/* clear list */
|
/* clear list */
|
||||||
@@ -279,6 +282,8 @@ void BPY_app_handlers_reset(const short do_all)
|
|||||||
|
|
||||||
Py_DECREF(perm_id_str);
|
Py_DECREF(perm_id_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyGILState_Release(gilstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the actual callback - not necessarily called from py */
|
/* the actual callback - not necessarily called from py */
|
||||||
|
Reference in New Issue
Block a user