Problems with WM_PAINT and threads

Ove Kaaven ovehk at ping.uio.no
Thu Aug 30 10:34:11 CDT 2001


After trying to merge Wine 20010824 into WineX, I've encountered a
threading issue. A window is created in an app thread:

0806d1f0:Call user32.CreateWindowExA(00000000,
 403cb0d4 "Afx:400000:3",0055b674 "3DMark - Display Window",
 80000000,00000000,00000000,00000280,000001e0,00000000,
 00000000,00400000,00000000) ret=5f40c486
trace:win:WIN_CreateWindowEx "3DMark - Display Window"
 "Afx:400000:3" 00000000 80000000 0,0 640x480 0000 0000 00400000 (nil)
trace:win:WIN_CreateWindowEx winproc type is 2 (WIN_PROC_32A)
...

This works fine, until our ddraw update thread somehow decides to send it
a message after syncing its own window 31bc:

08107170:Ret  x11drv.CreateWindow() retval=00000001 ret=407f542f
trace:win:WIN_CreateWindowEx created window 31bc
08107170:Call x11drv.SetWindowPos(44a12e88) ret=407fb159
trace:x11drv:X11DRV_SetWindowPos hwnd 31bc, swp (0,0)-(0,0) flags 0000255b
trace:x11drv:X11DRV_SetWindowPos        current (0,0)-(800,600), style 84000000
warn:x11drv:SWP_DoOwnedPopups (31bc) hInsertAfter = 0000
trace:x11drv:X11DRV_sync_whole_window_position setting win 3200001 pos 0,0,800x600
 after 8081268 changes=40
trace:x11drv:X11DRV_SetWindowPos mapping win 31bc
trace:x11drv:X11DRV_SetWindowPos        status flags = 1843
08107170:Ret  x11drv.SetWindowPos() retval=00000001 ret=407fb159
trace:win:RedrawWindow 31bc (0000) NULL 0,0-0,0 0000 flags=0180
trace:win:RDW_UpdateRgns        hwnd 31bc [0000] -> hrgn [0000], flags [0180]
trace:win:RDW_Paint     hwnd 31bc [0000] -> hrgn [0000], flags [0180]
08107170:Call x11drv.MsgWaitForMultipleObjectsEx(00000002,44a12da4,ffffffff,000000ff,00000000) ret=407e4237
trace:x11drv:X11DRV_Expose win 31bc (3200002) 0,0 800x600
trace:win:RedrawWindow 31bc (0000) rect 0,0-800,600 0000 flags=0005
trace:win:RDW_UpdateRgns        hwnd 31bc [174a] -> hrgn [0000], flags [0005]
trace:win:RDW_Paint     hwnd 31bc [174a] -> hrgn [0000], flags [0005]
08107170:Ret  x11drv.MsgWaitForMultipleObjectsEx() retval=00000002 ret=407e4237
08107170:Call x11drv.MsgWaitForMultipleObjectsEx(00000000,00000000,00000000,00000000,00000000) ret=407a1ca4
08107170:Ret  x11drv.MsgWaitForMultipleObjectsEx() retval=00000102 ret=407a1ca4
trace:msg:MSG_peek_message got type 5 msg f hwnd 0 wp 0 lp 0
trace:win:WIN_FindWinToRepaint found 3124
trace:win:RedrawWindow 3124 (1746) NULL 0,0-0,0 0000 flags=0050
trace:win:RDW_UpdateRgns        hwnd 3124 [1746] -> hrgn [0000], flags [0050]
trace:win:RDW_Paint     hwnd 3124 [1746] -> hrgn [0000], flags [0050]
trace:message:SPY_EnterMessage         (00003124) "3DMark - D..."  message [000f] WM_PAINT dispatched  wp=00000000 lp=00000000
08107170:Call window proc 0x5f4019fa (hwnd=00003124,msg=WM_PAINT,wp=00000000,lp=00000000)
^^^^^^^^                                   ^^^^^^^^

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

Maybe Alexandre did a mistake somewhere in his restructures?





More information about the wine-devel mailing list