Added PyGILState_Ensure and PyGILState_Release funcs around module reloading.
Without them blender would crash when reloading scripts.
This commit is contained in:
@@ -408,7 +408,8 @@ void BPY_rebuild_syspath( void )
|
|||||||
PyObject *mod, *dict, *syspath;
|
PyObject *mod, *dict, *syspath;
|
||||||
char dirpath[FILE_MAX];
|
char dirpath[FILE_MAX];
|
||||||
char *sdir = NULL;
|
char *sdir = NULL;
|
||||||
|
PyGILState_STATE gilstate = PyGILState_Ensure();
|
||||||
|
|
||||||
mod = PyImport_ImportModule( "sys" );
|
mod = PyImport_ImportModule( "sys" );
|
||||||
if (!mod) {
|
if (!mod) {
|
||||||
printf("error: could not import python sys module. some modules may not import.\n");
|
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);
|
Py_DECREF(mod);
|
||||||
|
PyGILState_Release(gilstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user