Commit c9962bbb authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

opengl32: Check for valid context in wglGetProcAddress.

parent c754f28f
......@@ -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);
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment