Prevent tdm crash if window manager or compositor do not start

(cherry picked from commit 8a80c7f3df)
v3.5.13-sru
Timothy Pearson 13 years ago committed by Slávek Banko
parent e85de28ed2
commit 2873e76d92

@ -452,33 +452,37 @@ kg_main( const char *argv0 )
KGVerify::done(); KGVerify::done();
if (comp) { if (comp) {
if (_compositor == "kompmgr") { if (comp->isRunning()) {
// Change process UID if (_compositor == "kompmgr") {
// Get user UID // Change process UID
passwd* userinfo = getpwnam(login_user.ascii()); // Get user UID
if (userinfo) { passwd* userinfo = getpwnam(login_user.ascii());
TQString newuid = TQString("%1").arg(userinfo->pw_uid); if (userinfo) {
// kompmgr allows us to change its uid in this manner: TQString newuid = TQString("%1").arg(userinfo->pw_uid);
// 1.) Send SIGUSER1 // kompmgr allows us to change its uid in this manner:
// 2.) Send the new UID to it on the command line // 1.) Send SIGUSER1
comp->kill(SIGUSR1); // 2.) Send the new UID to it on the command line
comp->writeStdin(newuid.ascii(), newuid.length()); comp->kill(SIGUSR1);
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->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; delete comp;
} }
if (kwin) { if (kwin) {
if (login_session_wm.endsWith("/startkde") || (login_session_wm == "failsafe")) { if (kwin->isRunning()) {
kwin->closeStdin(); if (login_session_wm.endsWith("/startkde") || (login_session_wm == "failsafe")) {
kwin->detach(); kwin->closeStdin();
dcop->detach(); kwin->detach();
} dcop->detach();
else { }
kwin->kill(); else {
dcop->kill(); kwin->kill();
dcop->kill();
}
} }
delete kwin; delete kwin;
delete dcop; delete dcop;

Loading…
Cancel
Save