Revision: 38265
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38265
Author: campbellbarton
Date: 2011-07-09 17:41:39 +0000 (Sat, 09 Jul 2011)
Log Message:
-----------
fix [#27683] Blender hangs when baking a particle system when a driver is
present
Modified Paths:
--------------
trunk/blender/source/blender/python/generic/py_capi_utils.c
trunk/blender/source/blender/python/generic/py_capi_utils.h
trunk/blender/source/blender/python/intern/bpy_driver.c
Modified: trunk/blender/source/blender/python/generic/py_capi_utils.c
===================================================================
--- trunk/blender/source/blender/python/generic/py_capi_utils.c 2011-07-09
17:09:28 UTC (rev 38264)
+++ trunk/blender/source/blender/python/generic/py_capi_utils.c 2011-07-09
17:41:39 UTC (rev 38265)
@@ -36,8 +36,6 @@
#include "BLI_path_util.h"
#endif
-#define PYC_INTERPRETER_ACTIVE
(((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
-
/* array utility function */
int PyC_AsArray(void *array, PyObject *value, const int length, const
PyTypeObject *type, const short is_double, const char *error_prefix)
{
Modified: trunk/blender/source/blender/python/generic/py_capi_utils.h
===================================================================
--- trunk/blender/source/blender/python/generic/py_capi_utils.h 2011-07-09
17:09:28 UTC (rev 38264)
+++ trunk/blender/source/blender/python/generic/py_capi_utils.h 2011-07-09
17:41:39 UTC (rev 38265)
@@ -50,4 +50,6 @@
void PyC_SetHomePath(const char *py_path_bundle);
+#define PYC_INTERPRETER_ACTIVE
(((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
+
#endif // PY_CAPI_UTILS_H
Modified: trunk/blender/source/blender/python/intern/bpy_driver.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_driver.c 2011-07-09
17:09:28 UTC (rev 38264)
+++ trunk/blender/source/blender/python/intern/bpy_driver.c 2011-07-09
17:41:39 UTC (rev 38265)
@@ -41,6 +41,8 @@
#include "bpy_driver.h"
+#include "../generic/py_capi_utils.h"
+
/* for pydrivers (drivers using one-line Python expressions to express
relationships between targets) */
PyObject *bpy_pydriver_Dict= NULL;
@@ -87,7 +89,7 @@
void BPY_driver_reset(void)
{
PyGILState_STATE gilstate;
- int use_gil= 1; // (PyThreadState_Get()==NULL);
+ int use_gil= !PYC_INTERPRETER_ACTIVE;
if(use_gil)
gilstate= PyGILState_Ensure();
@@ -120,7 +122,7 @@
*
* note: PyGILState_Ensure() isnt always called because python can call the
* bake operator which intern starts a thread which calls scene update which
- * does a driver update. to avoid a deadlock check PyThreadState_Get() if
PyGILState_Ensure() is needed.
+ * does a driver update. to avoid a deadlock check PYC_INTERPRETER_ACTIVE if
PyGILState_Ensure() is needed.
*/
float BPY_driver_exec(ChannelDriver *driver)
{
@@ -147,7 +149,7 @@
return 0.0f;
}
- use_gil= 1; //(PyThreadState_Get()==NULL);
+ use_gil= !PYC_INTERPRETER_ACTIVE;
if(use_gil)
gilstate= PyGILState_Ensure();
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs