Fix Cycles OpenCL issue if context/program creation fails, mistake by me,

patch #35866 by Doug Gale to fix it.
This commit is contained in:
Brecht Van Lommel
2013-06-26 12:24:33 +00:00
parent 5eda86a678
commit e11e30aadf

View File

@@ -241,6 +241,9 @@ public:
{ {
cl_context context = get_something<cl_context>(platform, device, &Slot::context, slot_locker); cl_context context = get_something<cl_context>(platform, device, &Slot::context, slot_locker);
if(!context)
return NULL;
/* caller is going to release it when done with it, so retain it */ /* caller is going to release it when done with it, so retain it */
cl_int ciErr = clRetainContext(context); cl_int ciErr = clRetainContext(context);
assert(ciErr == CL_SUCCESS); assert(ciErr == CL_SUCCESS);
@@ -255,6 +258,9 @@ public:
{ {
cl_program program = get_something<cl_program>(platform, device, &Slot::program, slot_locker); cl_program program = get_something<cl_program>(platform, device, &Slot::program, slot_locker);
if(!program)
return NULL;
/* caller is going to release it when done with it, so retain it */ /* caller is going to release it when done with it, so retain it */
cl_int ciErr = clRetainProgram(program); cl_int ciErr = clRetainProgram(program);
assert(ciErr == CL_SUCCESS); assert(ciErr == CL_SUCCESS);