[2/3] winex11.drv: Don't modify current state if glXMakeCurrent fails.
Matteo Bruni
matteo.mystral at gmail.com
Tue Mar 29 09:42:12 CDT 2011
-------------- next part --------------
From 8638b7ac03d03d361dffb1e9908217eb6e0710f8 Mon Sep 17 00:00:00 2001
From: Matteo Bruni <mbruni at codeweavers.com>
Date: Thu, 3 Mar 2011 21:06:33 +0100
Subject: winex11.drv: Don't modify current state if glXMakeCurrent fails.
---
dlls/winex11.drv/opengl.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index a9cc178..7df959d 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1904,7 +1904,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)) {
@@ -1914,10 +1913,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;
@@ -1932,6 +1933,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"));
--
1.7.3.4
More information about the wine-patches
mailing list