From 56e79aa87da99172896844d891102193f323fc5c Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 24 Oct 2010 04:17:36 +0000 Subject: Added a safer OpenCL shutdown procedure. Fixes issue 3015. Fixes issue 3089. Fixes issue 3099. Fixes issue 3360. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6307 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/OpenCL.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Source/Core/Common/Src/OpenCL.cpp') diff --git a/Source/Core/Common/Src/OpenCL.cpp b/Source/Core/Common/Src/OpenCL.cpp index 2d7b684074..f196fb5ed4 100644 --- a/Source/Core/Common/Src/OpenCL.cpp +++ b/Source/Core/Common/Src/OpenCL.cpp @@ -188,13 +188,16 @@ cl_kernel CompileKernel(cl_program program, const char *Function) void Destroy() { #if defined(HAVE_OPENCL) && HAVE_OPENCL - if(!g_context) - return; - clReleaseCommandQueue(g_cmdq); - clReleaseContext(g_context); - g_context = NULL; - g_cmdq = NULL; - + if (g_cmdq) + { + clReleaseCommandQueue(g_cmdq); + g_cmdq = NULL; + } + if (g_context) + { + clReleaseContext(g_context); + g_context = NULL; + } g_bInitialized = false; #endif } -- cgit v1.2.3