From d9ab22e4ed63ca53634c74d7c022d60106879f23 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Wed, 12 Jun 2013 13:55:20 +0800 Subject: [PATCH] Fix two bugs related to opencl context. 1. As getDevice will implicitly call setDevice, in getContext we should not need to call it again. 2. Fix an incorrect type casting. --- modules/ocl/src/initialization.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/ocl/src/initialization.cpp b/modules/ocl/src/initialization.cpp index a9cd08b9f..71289f621 100644 --- a/modules/ocl/src/initialization.cpp +++ b/modules/ocl/src/initialization.cpp @@ -930,8 +930,6 @@ namespace cv clCxt.reset(new Context); std::vector oclinfo; CV_Assert(getDevice(oclinfo, CVCL_DEVICE_TYPE_ALL) > 0); - oclinfo[0].impl->setDevice(0, 0, 0); - clCxt.get()->impl = oclinfo[0].impl->copy(); *((volatile int*)&val) = 1; } @@ -1056,7 +1054,7 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID ) Context* cv_ctx = Context::getContext(); if(cv_ctx) { - cl_context ctx = (cl_context)&(cv_ctx->impl->oclcontext); + cl_context ctx = cv_ctx->impl->oclcontext; if(ctx) openCLSafeCall(clReleaseContext(ctx)); }