Commit 0099d70a by Nicolas Capens

Fix resetting the current context on thread/process detach.

Bug 29540271 Change-Id: I0a5a63ad74339aec31e73b4a95c8978696e95782 Reviewed-on: https://swiftshader-review.googlesource.com/5670Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 6b91e70d
...@@ -42,10 +42,10 @@ static void glAttachThread() ...@@ -42,10 +42,10 @@ static void glAttachThread()
{ {
sw::Thread::setLocalStorage(currentTLS, current); sw::Thread::setLocalStorage(currentTLS, current);
current->context = 0; current->context = nullptr;
current->display = 0; current->display = nullptr;
current->drawSurface = 0; current->drawSurface = nullptr;
current->readSurface = 0; current->readSurface = nullptr;
} }
} }
...@@ -53,12 +53,10 @@ static void glDetachThread() ...@@ -53,12 +53,10 @@ static void glDetachThread()
{ {
TRACE("()"); TRACE("()");
gl::Current *current = (gl::Current*)sw::Thread::getLocalStorage(currentTLS); wglMakeCurrent(NULL, NULL);
if(current) delete (gl::Current*)sw::Thread::getLocalStorage(currentTLS);
{ sw::Thread::setLocalStorage(currentTLS, nullptr);
delete current;
}
} }
CONSTRUCTOR static bool glAttachProcess() CONSTRUCTOR static bool glAttachProcess()
...@@ -207,7 +205,7 @@ Device *getDevice() ...@@ -207,7 +205,7 @@ Device *getDevice()
{ {
Context *context = getContext(); Context *context = getContext();
return context ? context->getDevice() : 0; return context ? context->getDevice() : nullptr;
} }
void setCurrentDisplay(Display *dpy) void setCurrentDisplay(Display *dpy)
......
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