Commit 6ed0304a by Nicolas Capens

Reset TLS when the EGL context is destroyed.

Bug 20045861 Change-Id: I16e76a464f58ffb47ed92374cf9d2aef21cc7603 Reviewed-on: https://swiftshader-review.googlesource.com/2783Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 8ea8784d
...@@ -189,6 +189,11 @@ void Display::terminate() ...@@ -189,6 +189,11 @@ void Display::terminate()
{ {
destroyContext(*mContextSet.begin()); destroyContext(*mContextSet.begin());
} }
if(this == getCurrentDisplay())
{
setCurrentDisplay(EGL_NO_DISPLAY);
}
} }
bool Display::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig) bool Display::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
...@@ -434,12 +439,29 @@ void Display::destroySurface(egl::Surface *surface) ...@@ -434,12 +439,29 @@ void Display::destroySurface(egl::Surface *surface)
{ {
delete surface; delete surface;
mSurfaceSet.erase(surface); mSurfaceSet.erase(surface);
if(surface == getCurrentDrawSurface())
{
setCurrentDrawSurface(EGL_NO_SURFACE);
}
if(surface == getCurrentReadSurface())
{
setCurrentReadSurface(EGL_NO_SURFACE);
}
} }
void Display::destroyContext(egl::Context *context) void Display::destroyContext(egl::Context *context)
{ {
context->destroy(); context->destroy();
mContextSet.erase(context); mContextSet.erase(context);
if(context == getCurrentContext())
{
setCurrentContext(EGL_NO_CONTEXT);
setCurrentDrawSurface(EGL_NO_SURFACE);
setCurrentReadSurface(EGL_NO_SURFACE);
}
} }
bool Display::isInitialized() const bool Display::isInitialized() const
......
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