Commit ad1ba56f authored by Andrey Pavlenko's avatar Andrey Pavlenko Committed by OpenCV Buildbot

Merge pull request #1597 from alalek:ocl_fix_cleanup

parents c8207779 6b9f74ae
...@@ -724,7 +724,14 @@ bool supportsFeature(FEATURE_TYPE featureType) ...@@ -724,7 +724,14 @@ bool supportsFeature(FEATURE_TYPE featureType)
struct __Module struct __Module
{ {
__Module() { /* moved to Context::getContext(): initializeOpenCLDevices(); */ } __Module() { /* moved to Context::getContext(): initializeOpenCLDevices(); */ }
~__Module() { ContextImpl::cleanupContext(); } ~__Module()
{
#if defined(WIN32) && defined(CVAPI_EXPORTS)
// nothing, see DllMain
#else
ContextImpl::cleanupContext();
#endif
}
}; };
static __Module __module; static __Module __module;
...@@ -742,6 +749,7 @@ BOOL WINAPI DllMain(HINSTANCE /*hInst*/, DWORD fdwReason, LPVOID lpReserved) ...@@ -742,6 +749,7 @@ BOOL WINAPI DllMain(HINSTANCE /*hInst*/, DWORD fdwReason, LPVOID lpReserved)
{ {
if (lpReserved != NULL) // called after ExitProcess() call if (lpReserved != NULL) // called after ExitProcess() call
cv::ocl::__termination = true; cv::ocl::__termination = true;
cv::ocl::ContextImpl::cleanupContext();
} }
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment