Problems with WM_PAINT and threads

Alexandre Julliard julliard at winehq.com
Fri Sep 7 15:46:52 CDT 2001


Ove Kaaven <ovehk at ping.uio.no> writes:

> After Wine dispatches this WM_PAINT message from the wrong thread,
> 3DMark2000 fails to locate its thread-local data, gets confused, and
> crashes.

Does this help?

Index: windows/win.c
===================================================================
RCS file: /opt/cvs-commit/wine/windows/win.c,v
retrieving revision 1.147
diff -u -r1.147 win.c
--- windows/win.c	2001/08/29 00:16:00	1.147
+++ windows/win.c	2001/09/07 19:34:24
@@ -387,15 +387,17 @@
     hwndRet = pWnd->hwndSelf;
 
     /* look among siblings if we got a transparent window */
-    while (pWnd && ((pWnd->dwExStyle & WS_EX_TRANSPARENT) ||
-                    !(pWnd->hrgnUpdate || (pWnd->flags & WIN_INTERNAL_PAINT))))
+    while (pWnd)
     {
+        if (!(pWnd->dwExStyle & WS_EX_TRANSPARENT) &&
+            (pWnd->hrgnUpdate || (pWnd->flags & WIN_INTERNAL_PAINT)) &&
+            GetWindowThreadProcessId( pWnd->hwndSelf, NULL ) == GetCurrentThreadId())
+        {
+            hwndRet = pWnd->hwndSelf;
+            WIN_ReleaseWndPtr(pWnd);
+            break;
+        }
         WIN_UpdateWndPtr(&pWnd,pWnd->next);
-    }
-    if (pWnd)
-    {
-        hwndRet = pWnd->hwndSelf;
-    WIN_ReleaseWndPtr(pWnd);
     }
     TRACE("found %04x\n",hwndRet);
     return hwndRet;

-- 
Alexandre Julliard
julliard at winehq.com




More information about the wine-devel mailing list