Quit kwin_x11 on dbus disconnection
Kwin exits when KSelectionOwner loses ownership. But a different code path is found in site. Kwin receives Disconnected signal from interface org.freedesktop.DBus.Local before losing ownership. In this situation, kwin won't exit and won't unregister service org.kde.KWin properly. Although this service will be automatically removed from dbus after a while, disconnected signal may not properly get triggered.
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.
This commit adds another exiting condition for kwin_x11: on dbus disconnected. This can help solving the kwin_x11 indefinite loop issue.
I have posted background story to several places:
- KDE-devel mail list
- Why org.freedesktop.DBus.Local.Disconnected is called?
- Bug 415008 - KWin-5.17.4 hangs inside loop in QXcbConnection::getTimestamp()
- Bug 428817 - org.kde.KWin is not unregistered properly on logout
- #1712 kwin_x11 runs indefinitely because Xvnc exits too early
I made another patch to work with this one to plasma workspace: merge-request #439
BUG 415008
BUG 428817