From 15101e704bf5436eca2aabc7cbd26b370f7de4b0 Mon Sep 17 00:00:00 2001 From: Alex Xie Date: Fri, 14 Jan 2022 11:53:22 -0500 Subject: [PATCH] SWDEV-312368 - Segmentation fault in test_gl When OCL failed to obtain function pointer from GL, we should not call it. Change-Id: I50f69d270ce445386906a286e44c4e8c83722302 --- rocclr/device/pal/paldevicegl.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rocclr/device/pal/paldevicegl.cpp b/rocclr/device/pal/paldevicegl.cpp index e8a95d0e6c..d3752c4a57 100644 --- a/rocclr/device/pal/paldevicegl.cpp +++ b/rocclr/device/pal/paldevicegl.cpp @@ -804,10 +804,18 @@ bool Device::glDissociate(void* GLplatformContext, void* GLdeviceContext) const */ #ifdef ATI_OS_LINUX GLXContext ctx = (GLXContext)GLplatformContext; - return (glXEndCLInteropAMD(ctx, 0)) ? true : false; + if (glXEndCLInteropAMD == nullptr) { + return false; + } else { + return (glXEndCLInteropAMD(ctx, 0)) ? true : false; + } #else HGLRC hRC = (HGLRC)GLplatformContext; - return (wglEndCLInteropAMD(hRC, 0)) ? true : false; + if (wglEndCLInteropAMD == nullptr) { + return false; + } else { + return (wglEndCLInteropAMD(hRC, 0)) ? true : false; + } #endif }