diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-02-25 21:35:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-02-25 21:35:35 +0300 |
commit | 3dd622b2b485a221131e1f50dd5aef16b29ecdf9 (patch) | |
tree | 78a1da3edf32d7e03941eff6be7ef48e201f94ee /source/blender/python | |
parent | 6f1b9eb9ac400d2680b7f857593ee375479650d9 (diff) |
Added PyGILState_Ensure and PyGILState_Release funcs around module reloading.
Without them blender would crash when reloading scripts.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/BPY_interface.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 75ed8e086d9..8adaddf14c5 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -408,7 +408,8 @@ void BPY_rebuild_syspath( void ) PyObject *mod, *dict, *syspath; char dirpath[FILE_MAX]; char *sdir = NULL; - + PyGILState_STATE gilstate = PyGILState_Ensure(); + mod = PyImport_ImportModule( "sys" ); if (!mod) { printf("error: could not import python sys module. some modules may not import.\n"); @@ -454,7 +455,7 @@ void BPY_rebuild_syspath( void ) } Py_DECREF(mod); - + PyGILState_Release(gilstate); } /**************************************************************************** |