Changeset View
Changeset View
Standalone View
Standalone View
ksldapp.cpp
Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Line(s) | 164 | { | |||
---|---|---|---|---|---|
208 | ); | 208 | ); | ||
209 | 209 | | |||
210 | m_lockProcess = new QProcess(); | 210 | m_lockProcess = new QProcess(); | ||
211 | m_lockProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel); | 211 | m_lockProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel); | ||
212 | m_lockProcess->setReadChannel(QProcess::StandardOutput); | 212 | m_lockProcess->setReadChannel(QProcess::StandardOutput); | ||
213 | auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished); | 213 | auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished); | ||
214 | connect(m_lockProcess, finishedSignal, this, | 214 | connect(m_lockProcess, finishedSignal, this, | ||
215 | [this](int exitCode, QProcess::ExitStatus exitStatus) { | 215 | [this](int exitCode, QProcess::ExitStatus exitStatus) { | ||
216 | | ||||
217 | qDebug() << "Greeter process exitted with status:" | ||||
218 | << exitStatus << "exit code:" << exitCode; | ||||
219 | | ||||
216 | if (m_isWayland && m_waylandDisplay && m_greeterClientConnection) { | 220 | if (m_isWayland && m_waylandDisplay && m_greeterClientConnection) { | ||
217 | m_greeterClientConnection->destroy(); | 221 | m_greeterClientConnection->destroy(); | ||
218 | } | 222 | } | ||
219 | if ((!exitCode && exitStatus == QProcess::NormalExit) || s_graceTimeKill || s_logindExit) { | 223 | | ||
224 | const bool regularExit = !exitCode && exitStatus == QProcess::NormalExit; | ||||
225 | if (regularExit || s_graceTimeKill || s_logindExit) { | ||||
220 | // unlock process finished successfully - we can remove the lock grab | 226 | // unlock process finished successfully - we can remove the lock grab | ||
227 | | ||||
228 | if (regularExit) { | ||||
229 | qDebug() << "Unlocking now on regular exit."; | ||||
230 | } else if (s_graceTimeKill) { | ||||
231 | qDebug() << "Unlocking anyway due to grace time."; | ||||
232 | } else { | ||||
233 | Q_ASSERT(s_logindExit); | ||||
234 | qDebug() << "Unlocking anyway since forced through logind."; | ||||
235 | } | ||||
236 | | ||||
221 | s_graceTimeKill = false; | 237 | s_graceTimeKill = false; | ||
222 | s_logindExit = false; | 238 | s_logindExit = false; | ||
223 | doUnlock(); | 239 | doUnlock(); | ||
224 | return; | 240 | return; | ||
225 | } | 241 | } | ||
226 | // failure, restart lock process | 242 | | ||
243 | qWarning() << "Greeter process exit unregular. Restarting lock."; | ||||
244 | | ||||
227 | m_greeterCrashedCounter++; | 245 | m_greeterCrashedCounter++; | ||
228 | if (m_greeterCrashedCounter < 4) { | 246 | if (m_greeterCrashedCounter < 4) { | ||
229 | // Perhaps it crashed due to a graphics driver issue, force software rendering now | 247 | // Perhaps it crashed due to a graphics driver issue, force software rendering now | ||
248 | qDebug("Trying to lock again with software rendering (%d/4).", | ||||
249 | m_greeterCrashedCounter); | ||||
230 | setForceSoftwareRendering(true); | 250 | setForceSoftwareRendering(true); | ||
231 | startLockProcess(EstablishLock::Immediate); | 251 | startLockProcess(EstablishLock::Immediate); | ||
232 | } else if (m_lockWindow) { | 252 | } else if (m_lockWindow) { | ||
253 | qWarning("Everything else failed. Need to put Greeter in emergency mode."); | ||||
233 | m_lockWindow->emergencyShow(); | 254 | m_lockWindow->emergencyShow(); | ||
255 | } else { | ||||
256 | qCritical("Greeter process exitted and we could in no way recover from that!"); | ||||
234 | } | 257 | } | ||
235 | } | 258 | } | ||
zzag: Shouldn't it be in an else branch? | |||||
romangg: Yes, thanks! | |||||
236 | ); | 259 | ); | ||
237 | connect(m_lockProcess, &QProcess::errorOccurred, this, | 260 | connect(m_lockProcess, &QProcess::errorOccurred, this, | ||
238 | [this](QProcess::ProcessError error) { | 261 | [this](QProcess::ProcessError error) { | ||
239 | if (error == QProcess::FailedToStart) { | 262 | if (error == QProcess::FailedToStart) { | ||
263 | qDebug() << "Greeter Process failed to start. Trying to directly unlock again."; | ||||
240 | doUnlock(); | 264 | doUnlock(); | ||
241 | m_waylandServer->stop(); | 265 | m_waylandServer->stop(); | ||
242 | qCritical() << "Greeter Process not available"; | 266 | qCritical() << "Greeter Process not available"; | ||
267 | } else { | ||||
268 | qWarning() << "Greeter Process encountered an unhandled error:" << error; | ||||
243 | } | 269 | } | ||
244 | } | 270 | } | ||
245 | ); | 271 | ); | ||
246 | m_lockedTimer.invalidate(); | 272 | m_lockedTimer.invalidate(); | ||
247 | m_graceTimer->setSingleShot(true); | 273 | m_graceTimer->setSingleShot(true); | ||
248 | connect(m_graceTimer, &QTimer::timeout, this, &KSldApp::endGraceTime); | 274 | connect(m_graceTimer, &QTimer::timeout, this, &KSldApp::endGraceTime); | ||
249 | // create our D-Bus interface | 275 | // create our D-Bus interface | ||
250 | new Interface(this); | 276 | new Interface(this); | ||
▲ Show 20 Lines • Show All 352 Lines • ▼ Show 20 Line(s) | 588 | { | |||
603 | } | 629 | } | ||
604 | if (m_forceSoftwareRendering) { | 630 | if (m_forceSoftwareRendering) { | ||
605 | env.insert(s_qtQuickBackend, QStringLiteral("software")); | 631 | env.insert(s_qtQuickBackend, QStringLiteral("software")); | ||
606 | } | 632 | } | ||
607 | 633 | | |||
608 | // start the Wayland server | 634 | // start the Wayland server | ||
609 | int fd = m_waylandServer->start(); | 635 | int fd = m_waylandServer->start(); | ||
610 | if (fd == -1) { | 636 | if (fd == -1) { | ||
637 | qWarning() << "Could not start the Wayland server."; | ||||
611 | emit m_lockProcess->errorOccurred(QProcess::FailedToStart); | 638 | emit m_lockProcess->errorOccurred(QProcess::FailedToStart); | ||
612 | return; | 639 | return; | ||
613 | } | 640 | } | ||
614 | 641 | | |||
615 | args << QStringLiteral("--ksldfd"); | 642 | args << QStringLiteral("--ksldfd"); | ||
616 | args << QString::number(fd); | 643 | args << QString::number(fd); | ||
617 | 644 | | |||
618 | m_lockProcess->setProcessEnvironment(env); | 645 | m_lockProcess->setProcessEnvironment(env); | ||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |
Shouldn't it be in an else branch?