Commit 1902e1cb authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

winex11.drv: Fix wglMakeContextCurrent with an invalid drawable.

parent 868974c6
......@@ -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());
......
......@@ -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) {
......
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