[Bf-blender-cvs] [dd96205] master: fix T40323 Segfault on baking after rendering

Dalai Felinto noreply at git.blender.org
Fri May 23 01:21:09 CEST 2014


Commit: dd96205d0aaae39e8d49cae2a0b4a63b34a8c39d
Author: Dalai Felinto
Date:   Thu May 22 20:18:45 2014 -0300
https://developer.blender.org/rBdd96205d0aaae39e8d49cae2a0b4a63b34a8c39d

fix T40323 Segfault on baking after rendering

The remaining functions in blender_python.cpp changed from using the
MACRO to use python_thread_state_save/python_thread_state_restore

Since this bug only happens when 'Persistent Images' is on it was
introduced in some of the early merges with master and I never caught
it.

Thanks Daniel Salazar for helping with the bug hunting.

===================================================================

M	intern/cycles/blender/blender_python.cpp

===================================================================

diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp
index 872f891..6148f49 100644
--- a/intern/cycles/blender/blender_python.cpp
+++ b/intern/cycles/blender/blender_python.cpp
@@ -158,8 +158,6 @@ static PyObject *bake_func(PyObject *self, PyObject *args)
 	if(!PyArg_ParseTuple(args, "OOsOiiO", &pysession, &pyobject, &pass_type, &pypixel_array,  &num_pixels, &depth, &pyresult))
 		return NULL;
 
-	Py_BEGIN_ALLOW_THREADS
-
 	BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
 
 	PointerRNA objectptr;
@@ -172,9 +170,11 @@ static PyObject *bake_func(PyObject *self, PyObject *args)
 	RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pypixel_array), &bakepixelptr);
 	BL::BakePixel b_bake_pixel(bakepixelptr);
 
+	python_thread_state_save(&session->python_thread_state);
+
 	session->bake(b_object, pass_type, b_bake_pixel, num_pixels, depth, (float *)b_result);
 
-	Py_END_ALLOW_THREADS
+	python_thread_state_restore(&session->python_thread_state);
 
 	Py_RETURN_NONE;
 }




More information about the Bf-blender-cvs mailing list