Remove clReleaseDevice call (workaround for pure virtual call on Windows)
authorAlexander Karsakov <alexander.karsakov@itseez.com>
Wed, 5 Mar 2014 13:57:06 +0000 (17:57 +0400)
committerAlexander Karsakov <alexander.karsakov@itseez.com>
Wed, 5 Mar 2014 13:57:06 +0000 (17:57 +0400)
modules/ocl/src/cl_context.cpp

index 37d6bb3..4edf1f7 100644 (file)
@@ -596,9 +596,16 @@ protected:
         CV_Assert(this != currentContext);
 
 #ifdef CL_VERSION_1_2
-        if (supportsFeature(FEATURE_CL_VER_1_2))
+#ifdef WIN32
+        // if process is on termination stage (ExitProcess was called and other threads were terminated)
+        // then disable command queue release because it may cause program hang
+        if (!__termination)
+#endif
         {
-            openCLSafeCall(clReleaseDevice(clDeviceID));
+            if (supportsFeature(FEATURE_CL_VER_1_2))
+            {
+                openCLSafeCall(clReleaseDevice(clDeviceID));
+            }
         }
 #endif
         if (deviceInfoImpl._id < 0) // not in the global registry, so we should cleanup it