winex11: Call sync_context for DC_GL_CHILD_WIN drawables before swapping buffers

Sebastian Lackner sebastian at fds-team.de
Tue Oct 1 01:17:43 CDT 2013


This patch fixes a race condition (which leads to a BadMatch xserver
error) in winex11/opengl.c.

The problem occurs when:

* One thread calls set_gl_drawable_parent and gl->type is
DC_GL_CHILD_WIN. In this case the previous gl->drawable is destroyed and
a new one is created. After this step the corresponding GL context is
marked as dirty because the drawable has changed.

* A second thread calls glxdrv_wglSwapBuffers and calls the function
pglXSwapBuffers on a non-current context.

By calling sync_context() (the same way as its done for
DC_GL_PIXMAP_WIN) this problem is fixed.

---
 dlls/winex11.drv/opengl.c |    1 +
 1 file changed, 1 insertion(+)

-------------- next part --------------
From cb6513250cfe8926bc1d7d5a4df668f02fa94e47 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian at fds-team.de>
Date: Tue, 1 Oct 2013 07:29:05 +0200
Subject: winex11: Call sync_context for DC_GL_CHILD_WIN drawables before
 swapping buffers

---
 dlls/winex11.drv/opengl.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 3e8480b..e9a0433 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -3220,6 +3220,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc )
         pglXSwapBuffers(gdi_display, gl->drawable);
         break;
     case DC_GL_CHILD_WIN:
+        if (ctx) sync_context( ctx );
         escape.gl_drawable = gl->drawable;
         /* fall through */
     default:
-- 
1.7.9.5


More information about the wine-patches mailing list