Commit 97907647 by Nicolas Capens Committed by Nicolas Capens

Fix crash on eglDestroyContext.

BUG=18211761 Change-Id: I7baf09e59330aad390c1fab37d7d3f1321faa3fc Reviewed-on: https://swiftshader-review.googlesource.com/1310Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 1ea92f8a
......@@ -839,6 +839,19 @@ EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurfac
egl::Display *display = static_cast<egl::Display*>(dpy);
egl::Context *context = static_cast<egl::Context*>(ctx);
if(ctx != EGL_NO_CONTEXT || draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE)
{
if(!validateDisplay(display))
{
return EGL_FALSE;
}
}
if(ctx == EGL_NO_CONTEXT && (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE))
{
return error(EGL_BAD_MATCH, EGL_FALSE);
}
if(ctx != EGL_NO_CONTEXT && !validateContext(display, context))
{
return EGL_FALSE;
......@@ -850,6 +863,11 @@ EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurfac
return EGL_FALSE;
}
if((draw != EGL_NO_SURFACE) ^ (read != EGL_NO_SURFACE))
{
return error(EGL_BAD_MATCH, EGL_FALSE);
}
if(draw != read)
{
UNIMPLEMENTED(); // FIXME
......
......@@ -255,11 +255,6 @@ void Context::makeCurrent(egl::Surface *surface)
void Context::destroy()
{
if(this == getContext())
{
makeCurrent(0);
}
delete this;
}
......
......@@ -267,11 +267,6 @@ void Context::makeCurrent(egl::Surface *surface)
void Context::destroy()
{
if(this == getContext())
{
makeCurrent(0);
}
delete this;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment