[Bf-blender-cvs] [201abb4] blender-v2.72-release: Fix T42005: Reset py-handlers could crash
Campbell Barton
noreply at git.blender.org
Wed Oct 15 16:58:57 CEST 2014
Commit: 201abb4946a03fd1df5e7be2c766154a8f6fa198
Author: Campbell Barton
Date: Mon Oct 13 17:44:27 2014 +0200
Branches: blender-v2.72-release
https://developer.blender.org/rB201abb4946a03fd1df5e7be2c766154a8f6fa198
Fix T42005: Reset py-handlers could crash
Wasn't acquiring the GIL.
===================================================================
M source/blender/python/intern/bpy_app_handlers.c
===================================================================
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index 41ca2d4..44da322 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -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 */
More information about the Bf-blender-cvs
mailing list