diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-05-25 22:56:13 -0500 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2012-06-03 03:27:34 +0200 |
commit | 2873e76d929e0c1e244278b952af5ae8a77bd705 (patch) | |
tree | 0a82e9131914ebc9f776c3d108dc096a5d42a286 | |
parent | e85de28ed274349e69df018d51b13c7662e50815 (diff) | |
download | tdebase-2873e76d929e0c1e244278b952af5ae8a77bd705.tar.gz tdebase-2873e76d929e0c1e244278b952af5ae8a77bd705.zip |
Prevent tdm crash if window manager or compositor do not start
(cherry picked from commit 8a80c7f3df3a7ce18398e00f2c91bf65b2325107)
-rw-r--r-- | kdm/kfrontend/kgapp.cpp | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/kdm/kfrontend/kgapp.cpp b/kdm/kfrontend/kgapp.cpp index 8d4864669..fef599488 100644 --- a/kdm/kfrontend/kgapp.cpp +++ b/kdm/kfrontend/kgapp.cpp @@ -452,33 +452,37 @@ kg_main( const char *argv0 ) KGVerify::done(); if (comp) { - if (_compositor == "kompmgr") { - // Change process UID - // Get user UID - passwd* userinfo = getpwnam(login_user.ascii()); - if (userinfo) { - TQString newuid = TQString("%1").arg(userinfo->pw_uid); - // kompmgr allows us to change its uid in this manner: - // 1.) Send SIGUSER1 - // 2.) Send the new UID to it on the command line - comp->kill(SIGUSR1); - comp->writeStdin(newuid.ascii(), newuid.length()); - usleep(50000); // Give the above function some time to execute. Note that on REALLY slow systems this could fail, leaving kompmgr running as root. TODO: Look into ways to make this more robust. + if (comp->isRunning()) { + if (_compositor == "kompmgr") { + // Change process UID + // Get user UID + passwd* userinfo = getpwnam(login_user.ascii()); + if (userinfo) { + TQString newuid = TQString("%1").arg(userinfo->pw_uid); + // kompmgr allows us to change its uid in this manner: + // 1.) Send SIGUSER1 + // 2.) Send the new UID to it on the command line + comp->kill(SIGUSR1); + comp->writeStdin(newuid.ascii(), newuid.length()); + usleep(50000); // Give the above function some time to execute. Note that on REALLY slow systems this could fail, leaving kompmgr running as root. TODO: Look into ways to make this more robust. + } } + comp->closeStdin(); + comp->detach(); } - comp->closeStdin(); - comp->detach(); delete comp; } if (kwin) { - if (login_session_wm.endsWith("/startkde") || (login_session_wm == "failsafe")) { - kwin->closeStdin(); - kwin->detach(); - dcop->detach(); - } - else { - kwin->kill(); - dcop->kill(); + if (kwin->isRunning()) { + if (login_session_wm.endsWith("/startkde") || (login_session_wm == "failsafe")) { + kwin->closeStdin(); + kwin->detach(); + dcop->detach(); + } + else { + kwin->kill(); + dcop->kill(); + } } delete kwin; delete dcop; |