-
Committer:
Tarmac
-
Author(s):
Sam Spilsbury
-
Date:
2012-12-05 11:37:42 UTC
-
mfrom:
(3494.5.19 compiz.fix_1085591)
-
Revision ID:
tarmac-20121205113742-3lsv5lsukevq7mv2
Fix race condition causing --replace to fail occasionally.
Clear XErrors right before taking SubstructureRedirectMask.
This changes the startup order a fair bit. The new order is now:
1. Do non-critical initialization that does not require a server grab
2. Do the ICCCM check to shut down the other window manager
3. Take server grab
4. Create edge windows
5. Clear error buffer
6. Attempt to take SubstructureRedirectMask
7. Clear error buffer -> if fail, exit
8. Create handles based on XQueryTree
9. Release server grab
(LP: #1085591)
System test added to demonstrate that compiz should exit when another client has SubstructureRedirectMask and attempting to take it results in an X error. It wasn't doing that before, and instead checked for X errors much earlier on (in error, because an X error up there wouldn't indicate that another WM was running at all).
In order to make this work properly, some changes had to be made to compiz. This adds a new runtime switch --send-startup-message which simply posts a message to all clients saying that the startup procedure has finished (and either succeeded or failed). Its needed because the location of when we take the server grab was changed to a much smaller critical section of the code, and that doesn't include the property change on the selection window. This is a far more accurate way of knowing that we've started, because we send it /after/ the startup procedure is done (rather than relying on the server to do the right thing.
Also fixed race condition caused by destroying the WMSnSelectionWindow before shutdown.
Because we haven't changed our active event mask
to remove SubstructureRedirectMask, other ICCCM
compliant window managers may receive a DestroyNotify
(eg, because we're blocked on XSync) before we get
a chance to close our display connection and remove
our SubstructureRedirectMask. That will cause them
to fail to start.
The selection window is destroyed anyways when we
close our connection, and that is a very accurate
indicator to other WM's that we are well and truly
gone because the protocol requires the implementation
to remove all client event masks before destroying
windows.
Added acceptance-tests for testing that behaviour. They are not added to the default test target for obvious reasons. Fixes: https://bugs.launchpad.net/bugs/1085591.
Approved by PS Jenkins bot, Daniel van Vugt.