Mesa (mesa_7_5_branch): wgl: Check for multiple threads before GET_CURRENT_CONTEXT.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Jul 6 16:40:21 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: 6f4167c8a215b561e5ad6eb58a8d875a5b8d8d6a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f4167c8a215b561e5ad6eb58a8d875a5b8d8d6a

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Jul  6 17:40:08 2009 +0100

wgl: Check for multiple threads before GET_CURRENT_CONTEXT.

Fixes wglthreads -- the 2nd thread MakeCurrent call was trying to flush
the first thread context while still in use.

---

 .../state_trackers/wgl/shared/stw_context.c        |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c
index 9df1ab7..8393efb 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_context.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_context.c
@@ -60,8 +60,14 @@ stw_context(GLcontext *glctx)
 static INLINE struct stw_context *
 stw_current_context(void)
 {
-   GET_CURRENT_CONTEXT( glctx );
-   return stw_context(glctx);
+   /* We must check if multiple threads are being used or GET_CURRENT_CONTEXT 
+    * might return the current context of the thread first seen. */
+   _glapi_check_multithread();
+
+   {
+      GET_CURRENT_CONTEXT( glctx );
+      return stw_context(glctx);
+   }
 }
 
 BOOL




More information about the mesa-commit mailing list