Merge "egl: Call loseCurrent after eglReleaseThread"
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index cfae095..34e840d 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -1339,13 +1339,14 @@
GLTrace_eglReleaseThread();
#endif
- // If there is context bound to the thread, release it
- egl_display_t::loseCurrent(get_context(getContext()));
-
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglReleaseThread) {
cnx->egl.eglReleaseThread();
}
+
+ // If there is context bound to the thread, release it
+ egl_display_t::loseCurrent(get_context(getContext()));
+
egl_tls_t::clearTLS();
return EGL_TRUE;
}