OSDN Git Service

wgl: Catch the attempt of releasing a context which is not current.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 9 Apr 2009 14:15:12 +0000 (15:15 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Thu, 9 Apr 2009 14:22:15 +0000 (15:22 +0100)
src/gallium/state_trackers/wgl/shared/stw_context.c

index 07d7452..6eb1bd0 100644 (file)
@@ -231,10 +231,17 @@ stw_release_context(
    if (!ctx)
       return FALSE;
    
-   /* XXX: The expectation is that ctx is the same context which is
+   /* The expectation is that ctx is the same context which is
     * current for this thread.  We should check that and return False
     * if not the case.
     */
+   {
+      GLcontext *glctx = ctx->st->ctx;
+      GET_CURRENT_CONTEXT( glcurctx );
+
+      if (glcurctx != glctx)
+         return FALSE;
+   }
 
    if (stw_make_current( NULL, 0 ) == FALSE)
       return FALSE;