Aric wrote:
> 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.
It's not really a crash, it's a debug feature ;-)
> > 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...
The relay trace code performs extra calls to _CheckNotLevel. This
routine calls DebugBreak if a dangerous lock is currently held.
The point of this is to prevent possible deadlocks caused by calling
non-Wine code while holding a Wine-system locks. As you have no control
over what non-Wine code does, you need to consider the possibility that
it might take a lock. In that case, you'd have a violation of the
'safe' order of taking locks (this order is: first non-Wine locks, then
the Win16Lock, then the WND lock, then short-term locks like the X11 lock),
opening up the possibility of deadlocks.
To warn about this possibility, every call from Wine to non-Wine code
checks that no Wine locks are currently held, when relay traces are active.
In your case, the 'non-Wine' code that is called is in fact again Wine
code, but relay debugging doesn't know this: as EVENT_ProcessEvent
should also work with native USER/USER32, it performs a Callout to
the USER32.RedrawWindow routine; for relay debugging this means that
Wine is calling non-Wine code which immediately calls back to Wine.
Actually, you really shouldn't be holding the lock at this point at all;
event.c takes care to use Wine-USER specific things only where it is
certain that we're actually using Wine-USER, not native USER ...
Why don't you simply cope with the possibility of windows being deleted
by checking for NULL pointers returned from WIN_FindWndPtr and aborting
the action when that happens?
Bye,
Ulrich
--
Dr. Ulrich Weigand
[EMAIL PROTECTED]