egl: make sure display is valid before cleanup
This commit is contained in:
parent
bf4346c849
commit
00954f1b60
|
@ -164,13 +164,19 @@ bool EGLGraphicsContext::init()
|
|||
void EGLGraphicsContext::term()
|
||||
{
|
||||
preTerm();
|
||||
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (context != EGL_NO_CONTEXT)
|
||||
eglDestroyContext(display, context);
|
||||
if (surface != EGL_NO_SURFACE)
|
||||
eglDestroySurface(display, surface);
|
||||
|
||||
if (display != EGL_NO_DISPLAY)
|
||||
{
|
||||
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
if (context != EGL_NO_CONTEXT)
|
||||
eglDestroyContext(display, context);
|
||||
|
||||
if (surface != EGL_NO_SURFACE)
|
||||
eglDestroySurface(display, surface);
|
||||
|
||||
eglTerminate(display);
|
||||
}
|
||||
|
||||
context = EGL_NO_CONTEXT;
|
||||
surface = EGL_NO_SURFACE;
|
||||
|
|
Loading…
Reference in New Issue