From b19c391570f557ddf6f97287acc8028d4682b270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 25 Mar 2015 21:23:48 -0700 Subject: [PATCH] GLX: Fixed context destroy. --- src/glcontext_glx.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/glcontext_glx.cpp b/src/glcontext_glx.cpp index e062c325..13a91de7 100644 --- a/src/glcontext_glx.cpp +++ b/src/glcontext_glx.cpp @@ -58,7 +58,7 @@ namespace bgfx { namespace gl m_context = (GLXContext)g_bgfxGLX; - if (NULL == m_context) + if (NULL == g_bgfxGLX) { XLockDisplay( (::Display*)g_bgfxX11Display); @@ -216,8 +216,13 @@ namespace bgfx { namespace gl void GlContext::destroy() { glXMakeCurrent( (::Display*)g_bgfxX11Display, 0, 0); - glXDestroyContext( (::Display*)g_bgfxX11Display, m_context); - XFree(m_visualInfo); + if (NULL == g_bgfxGLX) + { + glXDestroyContext( (::Display*)g_bgfxX11Display, m_context); + XFree(m_visualInfo); + } + m_context = NULL; + m_visualInfo = NULL; } void GlContext::resize(uint32_t /*_width*/, uint32_t /*_height*/, bool _vsync)