0024297: OpenGl_Texture::Release() might call OpenGL functions without active context
[occt.git] / src / OpenGl / OpenGl_ShaderObject.cxx
index 9537ccd..e84c11a 100644 (file)
@@ -139,7 +139,8 @@ void OpenGl_ShaderObject::Release (const OpenGl_Context* theCtx)
   Standard_ASSERT_RETURN (theCtx != NULL,
     "OpenGl_ShaderObject destroyed without GL context! Possible GPU memory leakage...",);
 
-  if (theCtx->core20 != NULL)
+  if (theCtx->core20 != NULL
+   && theCtx->IsValid())
   {
     theCtx->core20->glDeleteShader (myShaderID);
   }