== PyNodes ==

Early Ehlinger reported a deadlock when a script tells Blender to render an animation and there are pynodes. While investigating I saw related crashes in bg (blender -b) mode, still not fixed. This commit tries to fix the problem for interactive mode, then. What it does is releasing the lock before rendering and relocking after that, like theeth suggests in the bug report:

http://projects.blender.org/tracker/?func=detail&atid=125&aid=17389&group_id=9
This commit is contained in:
Willian Padovani Germano 2008-07-25 22:30:03 +00:00
parent 229a5809bb
commit f6b85a55fa
2 changed files with 5 additions and 1 deletions

@ -410,12 +410,14 @@ void BPY_rebuild_syspath( void )
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");
PyGILState_Release(gilstate);
return; return;
} }
if (!bpy_orig_syspath_List) { /* should never happen */ if (!bpy_orig_syspath_List) { /* should never happen */
printf("error refershing python path\n"); printf("error refershing python path\n");
Py_DECREF(mod); Py_DECREF(mod);
PyGILState_Release(gilstate);
return; return;
} }

@ -565,6 +565,8 @@ PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
PyObject *RenderData_RenderAnim( BPy_RenderData * self ) PyObject *RenderData_RenderAnim( BPy_RenderData * self )
{ {
Scene *oldsce; Scene *oldsce;
/* this prevents a deadlock when there are pynodes: */
PyThreadState *tstate = PyEval_SaveThread();
if (!G.background) { if (!G.background) {
oldsce = G.scene; oldsce = G.scene;
@ -582,9 +584,9 @@ PyObject *RenderData_RenderAnim( BPy_RenderData * self )
if (G.scene->r.sfra > G.scene->r.efra) if (G.scene->r.sfra > G.scene->r.efra)
return EXPP_ReturnPyObjError (PyExc_RuntimeError, return EXPP_ReturnPyObjError (PyExc_RuntimeError,
"start frame must be less or equal to end frame"); "start frame must be less or equal to end frame");
RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
} }
PyEval_RestoreThread(tstate);
Py_RETURN_NONE; Py_RETURN_NONE;
} }