opengl32: glGetString() requires an active GL context (try 2)

Bruno Jesus 00cpxxx at gmail.com
Mon Jun 23 22:14:10 CDT 2014


try2:

Add tests.

original:

The fix from bug 13599 was removed between 1.5.9 and 1.5.10:

http://source.winehq.org/source/dlls/opengl32/wgl.c?v=wine-1.5.9#L1270
http://source.winehq.org/source/dlls/opengl32/wgl.c?v=wine-1.5.10#L1547

See http://bugs.winehq.org/show_bug.cgi?id=36506#c6 for more info.

Fixes bug http://bugs.winehq.org/show_bug.cgi?id=36506
-------------- next part --------------
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
index 7384cb4..f9f01e6 100644
--- a/dlls/opengl32/tests/opengl.c
+++ b/dlls/opengl32/tests/opengl.c
@@ -1668,6 +1668,8 @@ START_TEST(opengl)
         test_message_window();
         test_dc(hwnd, hdc);
 
+        ok(!glGetString(GL_RENDERER) && !glGetString(GL_VERSION) && !glGetString(GL_VENDOR),
+           "Expected NULL string when no active context is set\n");
         hglrc = wglCreateContext(hdc);
         res = wglMakeCurrent(hdc, hglrc);
         ok(res, "wglMakeCurrent failed!\n");
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 9255e34..f5adefd 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -1706,7 +1706,7 @@ static GLubyte *filter_extensions( const char *extensions )
 const GLubyte * WINAPI glGetString( GLenum name )
 {
     const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
-    const GLubyte *ret = funcs->gl.p_glGetString( name );
+    const GLubyte *ret = funcs ? funcs->gl.p_glGetString( name ) : NULL;
 
     if (name == GL_EXTENSIONS && ret)
     {


More information about the wine-patches mailing list