Module: wine Branch: master Commit: c9962bbb581057b0f06473d3360631ed130b4bfc URL: http://source.winehq.org/git/wine.git/?a=commit;h=c9962bbb581057b0f06473d336...
Author: Roderick Colenbrander thunderbird2k@gmail.com Date: Sun Jun 24 22:42:11 2012 -0700
opengl32: Check for valid context in wglGetProcAddress.
---
dlls/opengl32/tests/opengl.c | 2 +- dlls/opengl32/wgl.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index ffc676e..c18b0ad 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -797,7 +797,7 @@ static void test_getprocaddress(HDC hdc) /* Temporarily disable the context, so we can see that we can't retrieve functions now. */ wglMakeCurrent(hdc, NULL); func = wglGetProcAddress("glActiveTextureARB"); - todo_wine ok(func == NULL, "Function lookup without a context passed, expected a failure; last error %#x\n", GetLastError()); + ok(func == NULL, "Function lookup without a context passed, expected a failure; last error %#x\n", GetLastError()); wglMakeCurrent(hdc, ctx); }
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 98b04d4..9200dd6 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -300,9 +300,18 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
TRACE("(%s)\n", lpszProc);
- if(lpszProc == NULL) + if (lpszProc == NULL) return NULL;
+ /* Without an active context opengl32 doesn't know to what + * driver it has to dispatch wglGetProcAddress. + */ + if (wglGetCurrentContext() == NULL) + { + WARN("No active WGL context found\n"); + return NULL; + } + /* First, look if it's not already defined in the 'standard' OpenGL functions */ if ((local_func = GetProcAddress(opengl32_handle, lpszProc)) != NULL) { TRACE(" found function in 'standard' OpenGL functions (%p)\n", local_func);