winex11.drv: Don't modify current state if glXMakeCurrent fails.

This commit is contained in:
Matteo Bruni 2011-03-03 21:06:33 +01:00 committed by Alexandre Julliard
parent 6af0bef46a
commit 77679c4e9c
1 changed files with 6 additions and 3 deletions

View File

@ -1907,7 +1907,6 @@ BOOL CDECL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
{
Drawable drawable = get_glxdrawable(physDev);
Wine_GLContext *prev_ctx = NtCurrentTeb()->glContext;
if (prev_ctx) prev_ctx->tid = 0;
/* The describe lines below are for debugging purposes only */
if (TRACE_ON(wgl)) {
@ -1917,10 +1916,12 @@ BOOL CDECL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
TRACE(" make current for dis %p, drawable %p, ctx %p\n", gdi_display, (void*) drawable, ctx->ctx);
ret = pglXMakeCurrent(gdi_display, drawable, ctx->ctx);
NtCurrentTeb()->glContext = ctx;
if(ret)
if (ret)
{
if (prev_ctx) prev_ctx->tid = 0;
NtCurrentTeb()->glContext = ctx;
ctx->has_been_current = TRUE;
ctx->tid = GetCurrentThreadId();
ctx->hdc = hdc;
@ -1935,6 +1936,8 @@ BOOL CDECL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
pglDrawBuffer(GL_FRONT_LEFT);
}
}
else
SetLastError(ERROR_INVALID_HANDLE);
}
wine_tsx11_unlock();
TRACE(" returning %s\n", (ret ? "True" : "False"));