Matteo Bruni : winex11.drv: Make wglMakeCurrent return the correct error when the drawable is invalid.
Alexandre Julliard
julliard at winehq.org
Wed Mar 30 13:15:37 CDT 2011
Module: wine
Branch: master
Commit: 716df1c2d246a35f11622044d2816260ba2ffdef
URL: http://source.winehq.org/git/wine.git/?a=commit;h=716df1c2d246a35f11622044d2816260ba2ffdef
Author: Matteo Bruni <mbruni at codeweavers.com>
Date: Thu Mar 17 22:49:23 2011 +0100
winex11.drv: Make wglMakeCurrent return the correct error when the drawable is invalid.
---
dlls/opengl32/tests/opengl.c | 6 +++---
dlls/winex11.drv/opengl.c | 6 ++++++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
index 8c81ba2..9834c6d 100644
--- a/dlls/opengl32/tests/opengl.c
+++ b/dlls/opengl32/tests/opengl.c
@@ -956,7 +956,7 @@ static void test_destroy(HDC oldhdc)
SetLastError(0xdeadbeef);
ret = wglMakeCurrent(dc, ctx);
err = GetLastError();
- todo_wine ok(!ret && err == ERROR_INVALID_HANDLE,
+ ok(!ret && err == ERROR_INVALID_HANDLE,
"Unexpected behavior when making context current, ret %d, last error %#x.\n", ret, err);
ok(wglGetCurrentContext() == ctx, "Wrong current context.\n");
@@ -977,7 +977,7 @@ static void test_destroy(HDC oldhdc)
SetLastError(0xdeadbeef);
ret = wglMakeCurrent(dc, ctx);
err = GetLastError();
- todo_wine ok(!ret && err == ERROR_INVALID_HANDLE,
+ ok(!ret && err == ERROR_INVALID_HANDLE,
"Unexpected behavior when making context current, ret %d, last error %#x.\n", ret, err);
ok(wglGetCurrentContext() == NULL, "Wrong current context.\n");
@@ -989,7 +989,7 @@ static void test_destroy(HDC oldhdc)
SetLastError(0xdeadbeef);
ret = wglMakeCurrent(dc, ctx);
err = GetLastError();
- todo_wine ok(!ret && err == ERROR_INVALID_HANDLE,
+ ok(!ret && err == ERROR_INVALID_HANDLE,
"Unexpected behavior when making context current, ret %d, last error %#x.\n", ret, err);
ok(wglGetCurrentContext() == oldctx, "Wrong current context.\n");
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index c5796a4..0a23e44 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1896,6 +1896,12 @@ BOOL CDECL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
ret = pglXMakeCurrent(gdi_display, None, NULL);
NtCurrentTeb()->glContext = NULL;
}
+ else if (!physDev->current_pf)
+ {
+ WARN("Trying to use an invalid drawable\n");
+ SetLastError(ERROR_INVALID_HANDLE);
+ ret = FALSE;
+ }
else if (ctx->fmt->iPixelFormat != physDev->current_pf)
{
WARN( "mismatched pixel format hdc %p %u ctx %p %u\n",
More information about the wine-cvs
mailing list