Added PyGILState_Ensure and PyGILState_Release funcs around module reloading.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 25 Feb 2008 18:35:35 +0000 (18:35 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 25 Feb 2008 18:35:35 +0000 (18:35 +0000)
Without them blender would crash when reloading scripts.

source/blender/python/BPY_interface.c

index 75ed8e086d9ba058ddb841e664ae1489b07a0f74..8adaddf14c5e0023c046f80612928c98ca97dc48 100644 (file)
@@ -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);
 }
 
 /****************************************************************************