I wrote:
OK, this perfectly agrees with my understanding of what a lock is. But I have got the impression that two processes can simultaneously get the X11 lock, and that this is the crux of the problem. To become sure, I have added some tracing in dlls/x11drv/x11drv_main.c:
When looking at dlls/ntdll/critsection.c, I just realized that it is perfectly possible that one and the same thread gets the lock twice (the lock has a recursion counter for this). And this is what actually happens. So everything ok at this point - sorry for bothering you with it.
Till