[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13867] trunk/blender/source/blender/ python/BPY_interface.c: Added PyGILState_Ensure and PyGILState_Release funcs around module reloading .

Campbell Barton ideasman42 at gmail.com
Mon Feb 25 19:35:35 CET 2008


Revision: 13867
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13867
Author:   campbellbarton
Date:     2008-02-25 19:35:35 +0100 (Mon, 25 Feb 2008)

Log Message:
-----------
Added PyGILState_Ensure and PyGILState_Release funcs around module reloading.
Without them blender would crash when reloading scripts.

Modified Paths:
--------------
    trunk/blender/source/blender/python/BPY_interface.c

Modified: trunk/blender/source/blender/python/BPY_interface.c
===================================================================
--- trunk/blender/source/blender/python/BPY_interface.c	2008-02-25 17:20:35 UTC (rev 13866)
+++ trunk/blender/source/blender/python/BPY_interface.c	2008-02-25 18:35:35 UTC (rev 13867)
@@ -408,7 +408,8 @@
 	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 @@
 	}
 	
 	Py_DECREF(mod);
-
+	PyGILState_Release(gilstate);
 }
 
 /****************************************************************************





More information about the Bf-blender-cvs mailing list