Author: jgardou
Date: Sat Mar  5 16:23:30 2011
New Revision: 50973

URL: http://svn.reactos.org/svn/reactos?rev=50973&view=rev
Log:
[OPENGL32]
  - Naive try to fix bug 5057

Modified:
    trunk/reactos/dll/win32/opengl32/opengl32.c

Modified: trunk/reactos/dll/win32/opengl32/opengl32.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/opengl32/opengl32.c?rev=50973&r1=50972&r2=50973&view=diff
==============================================================================
--- trunk/reactos/dll/win32/opengl32/opengl32.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/opengl32/opengl32.c [iso-8859-1] Sat Mar  5 
16:23:30 2011
@@ -72,7 +72,7 @@
 OPENGL32_ThreadDetach( void )
 {
     GLTHREADDATA* lpData = NULL;
-    PROC *dispatchTable = NULL;
+       TEB* teb = NtCurrentTeb();
 
     rosglMakeCurrent( NULL, NULL );
 
@@ -85,12 +85,15 @@
         lpData = NULL;
     }
 
-    dispatchTable = NtCurrentTeb()->glTable;
-    if (dispatchTable != NULL)
-    {
-        if (!HeapFree( GetProcessHeap(), 0, dispatchTable ))
+    if (teb->glTable != NULL)
+    {
+        if (!HeapFree( GetProcessHeap(), 0, teb->glTable ))
+               {
             DBGPRINT( "Warning: HeapFree() on dispatch table failed (%d)",
                       GetLastError() );
+               }
+               /* NULL-ify it. Even if something went wrong, it's not a good 
idea to keep it non NULL */
+               teb->glTable = NULL;
     }
 }
 


Reply via email to