Skip to content

Commit

Permalink
Make sure the tty is not occupuied after stopping the service
Browse files Browse the repository at this point in the history
Ensures that we will not still find an X server still on the tty if we
restart SDDM.
  • Loading branch information
aleixpol committed Mar 14, 2022
1 parent 7a16cd7 commit 0b07df7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/daemon/XorgDisplayServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ namespace SDDM {
process->terminate();

// wait for finished
if (!process->waitForFinished(5000))
if (!process->waitForFinished(5000)) {
process->kill();
process->waitForFinished(25000);
}
}

void XorgDisplayServer::finished() {
Expand Down
4 changes: 3 additions & 1 deletion src/helper/waylandhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ void stopProcess(QProcess *process)
if (process && process->state() != QProcess::NotRunning) {
qInfo() << "Stopping..." << process->program();
process->terminate();
if (!process->waitForFinished(5000))
if (!process->waitForFinished(5000)) {
process->kill();
process->waitForFinished(25000);
}
process->deleteLater();
process = nullptr;
}
Expand Down
4 changes: 3 additions & 1 deletion src/helper/xorguserhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ void XOrgUserHelper::stop()
if (m_serverProcess) {
qInfo("Stopping server...");
m_serverProcess->terminate();
if (!m_serverProcess->waitForFinished(5000))
if (!m_serverProcess->waitForFinished(5000)) {
m_serverProcess->kill();
m_serverProcess->waitForFinished(25000);
}
m_serverProcess->deleteLater();
m_serverProcess = nullptr;

Expand Down

0 comments on commit 0b07df7

Please sign in to comment.