Wait for unregistration of kwin before quit
Startkde exits without checking whether kwin exits or not. X server quits right after startkde. Kwin gets timestamp by sending a dummy message to X server and if X server is gone, kwin then gets trapped in indefinite loop. An easy way to reproduce this problem is through Xrdp. Xrdp starts Xvnc as X server and executes startkde. If click "log out" in KDE, startkde exits and therefore Xrdp terminates Xvnc. Kwin then keeps running in indefinite loop of getTimeStamp.
Currently startkde waits for unregistration of both interfaces: org.kde.ksmserver and org.kde.Shutdown. However, kwin should wait for exit of kwin too. Kwin registers a service org.kde.KWin and startkde should use unregistration signal of this service as an indicator to exit. But due to the problem in BUG 428817, dbus gets disconnected and kwin has no chance to proper unregister interface.
So this commit proposes a solution: on exit of both interfaces, startkde should check the disapperance of org.kde.KWin periodically. This method properly waits for kwin to gracefully exit. Afterwards, KDE session quits without problem.
- This commit depends on merge request #438 on kwin.
BUG 415008 BUG 428817