Module: wine Branch: master Commit: 1902e1cb9306b65ab903f02d855078545a1ddfa6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1902e1cb9306b65ab903f02d85...
Author: Matteo Bruni mbruni@codeweavers.com Date: Wed Mar 16 00:32:47 2011 +0100
winex11.drv: Fix wglMakeContextCurrent with an invalid drawable.
---
dlls/opengl32/tests/opengl.c | 8 ++++---- dlls/winex11.drv/opengl.c | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 7b6c911..1669d73 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -1129,10 +1129,10 @@ static void test_destroy_read(HDC oldhdc) SetLastError(0xdeadbeef); ret = pwglMakeContextCurrentARB(draw_dc, read_dc, ctx); err = GetLastError(); - todo_wine ok(!ret && (err == ERROR_INVALID_HANDLE || err == 0xc0070006), + ok(!ret && (err == ERROR_INVALID_HANDLE || err == 0xc0070006), "Unexpected behavior when making context current, ret %d, last error %#x.\n", ret, err);
- todo_wine ok(wglGetCurrentContext() == NULL, "Wrong current context.\n"); + ok(wglGetCurrentContext() == NULL, "Wrong current context.\n");
wglMakeCurrent(NULL, NULL);
@@ -1142,10 +1142,10 @@ static void test_destroy_read(HDC oldhdc) SetLastError(0xdeadbeef); ret = pwglMakeContextCurrentARB(draw_dc, read_dc, ctx); err = GetLastError(); - todo_wine ok(!ret && (err == ERROR_INVALID_HANDLE || err == 0xc0070006), + ok(!ret && (err == ERROR_INVALID_HANDLE || err == 0xc0070006), "Unexpected behavior when making context current, last error %#x.\n", err);
- todo_wine ok(wglGetCurrentContext() == oldctx, "Wrong current context.\n"); + ok(wglGetCurrentContext() == oldctx, "Wrong current context.\n");
ret = wglDeleteContext(ctx); ok(ret, "Failed to delete GL context, last error %#x.\n", GetLastError()); diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 1d2eacf..81979ae 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1972,6 +1972,12 @@ BOOL CDECL X11DRV_wglMakeContextCurrentARB(X11DRV_PDEVICE* pDrawDev, X11DRV_PDEV ret = pglXMakeCurrent(gdi_display, None, NULL); NtCurrentTeb()->glContext = NULL; } + else if (!pDrawDev->current_pf) + { + WARN("Trying to use an invalid drawable\n"); + SetLastError(ERROR_INVALID_HANDLE); + ret = FALSE; + } else { if (NULL == pglXMakeContextCurrent) {