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(); }