I also did some looking into this, but not a lot.

I found that my patch fails with a debugmsg +relay. So something with
the relay messages is causing the problems. In fact the patch works with
debugmsg +all,-relay.  I have not had time to track down why relay
messages are causing the crash.

-aric

gerard patel wrote:
> 
> At 07:55 AM 5/10/00 -0500, you wrote:
> >Interesting, I did try this with some debug messages. Although I was using
> >+toolbar,+menus,+tab,+win  at the time. And also have run in managed mode
> >with the debug messages. I did worry that the patch may cause the program to
> >deadlock but saw no sign of it from my testing.
> >
> >The specific problem the patch address is that during window destruction it
> >is possible for a ConfigureNotify event to come in. If that messages is
> >timed right then the HWND pointer points to a valid window when ProcessEvent
> >is called. Then the thread destroying the window proceeds in deleting the
> >WND structure for the HWND. In the event processing loop, ConfigureNotify is
> >called and then EVENT_QueryZOrder.
> >
> >In QueryZOrder we get the WND pointer for the HWND but because the HWND is
> >now invalid we receive NULL. When we try to do X11DRV_WND_GetXWindow with
> >that we get null and then X dumps out with an error message.
> >
> >Placing the event processing inside the critical section seemed like a
> >logical fix., but maybe another one needs to be found.
> >
> 
> Maybe.
> Here is a trace generated; it starts in a call to MessageBox
> I have added a few trace to better understand what is happening.
> I am not sure at all, but my guess is that your change don't take
> in account it's possible to explicitly release the locks by
> WIN_SuspendWndLocks
> 
> Gerard
> 
> trace:win:ShowWindow hwnd=012c, cmd=1
> trace:relay:WINPROC_CallWndProc 
>(wndproc=0x4018b87c,hwnd=0000012c,msg=WM_SHOWWINDOW,wp=00000001,lp=00000000)
> trace:win:WIN_SuspendWndsLock thread=807ba38
> trace:relay:WINPROC_CallWndProc 
>(wndproc=0x401a148c,hwnd=0000012c,msg=WM_SHOWWINDOW,wp=00000001,lp=00000000)
> trace:win:WIN_SuspendWndsLock thread=807ba38
> trace:win:WIN_RestoreWndsLock thread=807ba38
> trace:win:WIN_RestoreWndsLock thread=807ba38
> trace:win:SetWindowPos hwnd 012c, swp (0,0)-(0,0) flags 00000063
> trace:win:SetWindowPos  current (200,130)-(628,218), style 84c80082
> trace:win:SetWindowPos before winposchanging for thread 807ba38 bChangePos = 1
> trace:relay:WINPROC_CallWndProc 
>(wndproc=0x4018b87c,hwnd=0000012c,msg=WM_WINDOWPOSCHANGING,wp=00000000,lp=40bd637c)
> trace:win:WIN_SuspendWndsLock thread=807ba38
> trace:relay:WINPROC_CallWndProc 
>(wndproc=0x401a148c,hwnd=0000012c,msg=WM_WINDOWPOSCHANGING,wp=00000000,lp=40bd637c)
> trace:win:WIN_SuspendWndsLock thread=807ba38
> trace:win:WIN_RestoreWndsLock thread=807ba38
> trace:win:WIN_RestoreWndsLock thread=807ba38
> trace:win:SetWindowPos after winposchaning for thread 807ba38, bChangePos=1
> warn:win:SWP_DoOwnedPopups (012c) hInsertAfter = 0000
> trace:relay:WINPROC_CallWndProc 
>(wndproc=0x4018b87c,hwnd=0000012c,msg=WM_NCCALCSIZE,wp=00000001,lp=40bd6224)
> trace:win:WIN_SuspendWndsLock thread=807ba38
> trace:relay:WINPROC_CallWndProc 
>(wndproc=0x401a148c,hwnd=0000012c,msg=WM_NCCALCSIZE,wp=00000001,lp=40bd6224)
> trace:win:WIN_SuspendWndsLock thread=807ba38
> trace:win:WIN_RestoreWndsLock thread=807ba38
> trace:win:WIN_RestoreWndsLock thread=807ba38
> trace:win:WINPOS_SendNCCalcSize 200,130-628,218
> trace:x11:TSXReconfigureWMWindow Call XReconfigureWMWindow
> 
> Here  the service thread is coming to play.
> 
> trace:timer:SERVICE_Loop Wait returned: 2, thread=80784b8
> trace:event:EVENT_ProcessAllEvents called (thread 80784b8).
> trace:timer:SERVICE_Loop Waiting for 3 objects
> 
> Return to the main thread.
> 
> trace:x11:TSXReconfigureWMWindow Ret XReconfigureWMWindow
> trace:x11:TSXMapWindow Call XMapWindow
> trace:x11:TSXMapWindow Ret XMapWindow
> trace:win:WIN_SuspendWndsLock thread=807ba38
> trace:event:X11DRV_EVENT_Synchronize called (thread 807ba38).
> trace:x11:TSXSync Call XSync
> 
> Service thread again.
> 
> trace:timer:SERVICE_Loop Wait returned: 2, thread=80784b8
> trace:event:EVENT_ProcessAllEvents called (thread 80784b8).
> trace:event:EVENT_ProcessEvent called thread=80784b8.
> trace:event:EVENT_ProcessEvent returns.
> trace:event:EVENT_ProcessEvent called thread=80784b8.
> trace:x11:TSXFindContext Call XFindContext
> trace:x11:TSXFindContext Ret XFindContext
> trace:event:EVENT_ProcessEvent Got event ConfigureNotify for hwnd 012c
> trace:win:EVENT_ConfigureNotify 012c moving from (200,130) to (367,437)
> 
> This is the special call to SetWindowPos for the 'flying windows' (flag 80000000)
> 
> trace:win:SetWindowPos hwnd 012c, swp (367,437)-(795,525) flags 80000015
> trace:win:SetWindowPos  current (200,130)-(628,218), style 94c80082
> trace:win:SetWindowPos before winposchanging for thread 80784b8 bChangePos = 0
> 
> Note that I have added a trace after this SetWindowPos; it is not called
> so this SetWindowPos don't return before the crash.
> 
> trace:win:WIN_SuspendWndsLock thread=80784b8
> trace:x11:TSXSync Ret XSync
> 
> The main thread comes back.
> 
> trace:event:X11DRV_EVENT_Synchronize after XSync (thread 807ba38).
> trace:event:EVENT_ProcessAllEvents called (thread 807ba38).
> trace:event:EVENT_ProcessEvent called thread=807ba38.
> trace:x11:TSXFindContext Call XFindContext
> trace:x11:TSXFindContext Ret XFindContext
> trace:event:EVENT_ProcessEvent Got event MapNotify for hwnd 012c
> trace:event:EVENT_ProcessEvent returns.
> trace:event:EVENT_ProcessEvent called thread=807ba38.
> trace:x11:TSXFindContext Call XFindContext
> trace:x11:TSXFindContext Ret XFindContext
> trace:event:EVENT_ProcessEvent Got event Expose for hwnd 012c
> Call user32.426: RedrawWindow(0000012c,40bd60f8,00000000,00000685) ret=40729007 
>fs=0247
> err:win32:SYSLEVEL_CheckNotLevel (2): Holding lock of level 2!
> 
> Bang...

Reply via email to