Module: wine Branch: master Commit: 1c93ab1ee0c66500838b730b11cc0c7f915e10a2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1c93ab1ee0c66500838b730b11...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Wed Sep 23 10:05:59 2009 +0200
wined3d: Cleanup after wglMakeCurrent() failures in context_set_current().
The D3D context is potentially destroyed, so we need to clear the thread's current D3D context. Found by Rico Schüller.
---
dlls/wined3d/context.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index e569e6e..935a92b 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -759,7 +759,10 @@ BOOL context_set_current(struct wined3d_context *ctx) TRACE("Switching to D3D context %p, GL context %p, device context %p.\n", ctx, ctx->glCtx, ctx->hdc); if (!pwglMakeCurrent(ctx->hdc, ctx->glCtx)) { - ERR("Failed to make GL context %p current on device context %p.\n", ctx->glCtx, ctx->hdc); + DWORD err = GetLastError(); + ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", + ctx->glCtx, ctx->hdc, err); + TlsSetValue(wined3d_context_tls_idx, NULL); return FALSE; } ctx->current = 1; @@ -769,7 +772,9 @@ BOOL context_set_current(struct wined3d_context *ctx) TRACE("Clearing current D3D context.\n"); if (!pwglMakeCurrent(NULL, NULL)) { - ERR("Failed to clear current GL context.\n"); + DWORD err = GetLastError(); + ERR("Failed to clear current GL context, last error %#x.\n", err); + TlsSetValue(wined3d_context_tls_idx, NULL); return FALSE; } }