[Bf-blender-cvs] [98082fe] opensubdiv-modifier: Fix crash when quitting blender without OpenCL initialized

Sergey Sharybin noreply at git.blender.org
Fri May 30 11:16:44 CEST 2014


Commit: 98082feb45d4f81e775ff64eafe475c90082f3d3
Author: Sergey Sharybin
Date:   Fri May 30 15:14:45 2014 +0600
https://developer.blender.org/rB98082feb45d4f81e775ff64eafe475c90082f3d3

Fix crash when quitting blender without OpenCL initialized

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

M	intern/opensubdiv/clInit.h

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

diff --git a/intern/opensubdiv/clInit.h b/intern/opensubdiv/clInit.h
index a1bc442..2fc2f9f 100644
--- a/intern/opensubdiv/clInit.h
+++ b/intern/opensubdiv/clInit.h
@@ -151,8 +151,12 @@ static bool initCL(cl_context *clContext, cl_command_queue *clQueue)
 
 static void uninitCL(cl_context clContext, cl_command_queue clQueue)
 {
-    clReleaseCommandQueue(clQueue);
-    clReleaseContext(clContext);
+    // It's possible that OpenCL wasn't used and hence wasn't initialized yet,
+    // no need to cleanup in this case.
+    if (clReleaseCommandQueue) {
+        clReleaseCommandQueue(clQueue);
+        clReleaseContext(clContext);
+    }
 }
 
 #endif // OSD_EXAMPLE_CL_INIT_H




More information about the Bf-blender-cvs mailing list