Bug Fixes in KDE Base
Remove emitting of aboutToQuit() from KApplication::xioErrhandler() - the application is not about to quit, it is about to fall flat on its face.
There is really not that much to do once KDE apps lose their connection to the X server.
How that can happen while the X server still continues to run is a different question and I don't know the answer.
It is quite possible it is caused by careless usage of one X connection from several threads concurrently without proper locking.