diff options
author | Timothy Pearson <[email protected]> | 2012-05-25 22:56:13 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-05-25 22:56:13 -0500 |
commit | 8a80c7f3df3a7ce18398e00f2c91bf65b2325107 (patch) | |
tree | 0e10a1047f16150b76c693db3d2d69db3e1dd2f5 /tdm | |
parent | e13c01e6863b7384e70f10068c6b76c1d24d9945 (diff) | |
download | tdebase-8a80c7f3df3a7ce18398e00f2c91bf65b2325107.tar.gz tdebase-8a80c7f3df3a7ce18398e00f2c91bf65b2325107.zip |
Prevent tdm crash if window manager or compositor do not start
Diffstat (limited to 'tdm')
-rw-r--r-- | tdm/kfrontend/kgapp.cpp | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/tdm/kfrontend/kgapp.cpp b/tdm/kfrontend/kgapp.cpp index 3b075945f..41d781d3c 100644 --- a/tdm/kfrontend/kgapp.cpp +++ b/tdm/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 (twin) { - if (login_session_wm.endsWith("/starttde") || (login_session_wm == "failsafe")) { - twin->closeStdin(); - twin->detach(); - dcop->detach(); - } - else { - twin->kill(); - dcop->kill(); + if (twin->isRunning()) { + if (login_session_wm.endsWith("/starttde") || (login_session_wm == "failsafe")) { + twin->closeStdin(); + twin->detach(); + dcop->detach(); + } + else { + twin->kill(); + dcop->kill(); + } } delete twin; delete dcop; |