Fix T49797: Exception from scene update handler might leak external engine descriptors

This was causing memory leaks in Cycles.

Some more detailed information in the comment in the code.

Seems to be safe and nice enough for 2.78a.
This commit is contained in:
Sergey Sharybin 2016-10-20 13:32:52 +02:00
parent 53cbda0f7f
commit dac53963a8
1 changed files with 7 additions and 1 deletions

View File

@ -317,7 +317,13 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
func = PyList_GET_ITEM(cb_list, pos);
ret = PyObject_Call(func, args, NULL);
if (ret == NULL) {
PyErr_Print();
/* Don't set last system variables because they might cause some
* dangling pointers to external render engines (when exception
* happens during rendering) which will break logic of render pipeline
* which expects to be the only user of render engine when rendering
* is finished.
*/
PyErr_PrintEx(0);
PyErr_Clear();
}
else {