Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address issues when sessions log out #1532

Merged
merged 3 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
3 changes: 1 addition & 2 deletions src/helper/HelperApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ namespace SDDM {
, m_socket(new QLocalSocket(this)) {
qInstallMessageHandler(HelperMessageHandler);
SignalHandler *s = new SignalHandler(this);
QObject::connect(s, &SignalHandler::sigtermReceived, m_session, [this] {
m_session->stop();
QObject::connect(s, &SignalHandler::sigtermReceived, m_session, [] {
QCoreApplication::instance()->exit(-1);
});

Expand Down
12 changes: 9 additions & 3 deletions src/helper/waylandhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ bool WaylandHelper::startCompositor(const QString &cmd)

void stopProcess(QProcess *process)
{
if (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 Expand Up @@ -124,7 +126,11 @@ void WaylandHelper::startGreeter(const QString &cmd)
connect(m_greeterProcess, &QProcess::readyReadStandardOutput, this, [this] {
qInfo() << m_greeterProcess->readAllStandardOutput();
});

connect(m_greeterProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
m_greeterProcess, [](int exitCode, QProcess::ExitStatus exitStatus) {
qDebug() << "wayland greeter finished" << exitCode << exitStatus;
QCoreApplication::instance()->quit();
});
if (m_watcher->status() == WaylandSocketWatcher::Started) {
m_greeterProcess->start();
} else if (m_watcher->status() == WaylandSocketWatcher::Failed) {
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