From 7b58c439fc22c98cddc8ce3c7d010362a9eba319 Mon Sep 17 00:00:00 2001 From: Deve Date: Thu, 14 Mar 2019 22:56:38 +0100 Subject: [PATCH] Fixed a crash on nvidia when recreating egl context --- lib/irrlicht/source/Irrlicht/CContextEGL.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/irrlicht/source/Irrlicht/CContextEGL.cpp b/lib/irrlicht/source/Irrlicht/CContextEGL.cpp index 81645bad8..6b185cb44 100644 --- a/lib/irrlicht/source/Irrlicht/CContextEGL.cpp +++ b/lib/irrlicht/source/Irrlicht/CContextEGL.cpp @@ -507,8 +507,11 @@ bool ContextManagerEGL::createContext() void ContextManagerEGL::close() { - eglMakeCurrent(m_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, - EGL_NO_CONTEXT); + if (m_egl_display != EGL_NO_DISPLAY) + { + eglMakeCurrent(m_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, + EGL_NO_CONTEXT); + } if (m_egl_context != EGL_NO_CONTEXT) { @@ -527,6 +530,8 @@ void ContextManagerEGL::close() eglTerminate(m_egl_display); m_egl_display = EGL_NO_DISPLAY; } + + eglReleaseThread(); }