[PATCH 3/3] wgl: Mark device context dirty after SetPixelFormat.

Roderick Colenbrander thunderbird2k at gmail.com
Mon May 10 08:36:33 CDT 2010


This patch fixes bug 21804. SetPixelFormat requests the creation of a child window
which in this case is performed in a different thread. The call to SetPixelFormat
is followed by a wglMakeCurrent in which the physDev has not yet been synchronized
which leads to the wrong drawable being made current. At a later point when the
physDev is up to date, the wrong drawable (the one which had to be current but isn't)
is passed to glXSwapBuffers which leads to a GLXBadDrawable.
---
 dlls/gdi32/painting.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index 1bcdc23..3cf6d70 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -376,6 +376,10 @@ BOOL WINAPI SetPixelFormat( HDC hdc, INT iPixelFormat,
     if (!dc->funcs->pSetPixelFormat) FIXME(" :stub\n");
     else bRet = dc->funcs->pSetPixelFormat(dc->physDev,iPixelFormat,ppfd);
 
+    /* Make sure the physDev is synchronized with drawables which might be allocated
+     * in a different thread by the driver e.g. in case of child window rendering. */
+    if (bRet) dc->dirty = 1;
+
     release_dc_ptr( dc );
     return bRet;
 }
-- 
1.6.3.3




More information about the wine-patches mailing list