From 4aa891e77384e88a4e809f92fa2bc9b50f67a07c Mon Sep 17 00:00:00 2001 From: Alexander Karsakov Date: Wed, 5 Mar 2014 17:57:06 +0400 Subject: [PATCH] Remove clReleaseDevice call (workaround for pure virtual call on Windows) --- modules/ocl/src/cl_context.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/ocl/src/cl_context.cpp b/modules/ocl/src/cl_context.cpp index 37d6bb33b..4edf1f7ff 100644 --- a/modules/ocl/src/cl_context.cpp +++ b/modules/ocl/src/cl_context.cpp @@ -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