plasma: force startup phase after 10 seconds

should not happen but if it does there is failsafe in place now

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-10 01:16:53 +03:00
parent 3484726b8a
commit 3fb06fbef0
2 changed files with 18 additions and 10 deletions

View file

@ -72,6 +72,7 @@
#endif
static const int s_sessiondelay = 500; // ms
static const int s_phasetimeout = 10000; // ms
static const QString s_defaultwm = QString::fromLatin1("kwin");
static const QStringList s_defaultwmcommands = QStringList() << s_defaultwm;
@ -1088,7 +1089,6 @@ void PlasmaApp::clientSaveCanceled()
void PlasmaApp::suspendStartup(const QString &app)
{
// TODO: timeout for suspending
m_startupSuspend++;
kDebug() << "startup suspended by" << app;
}
@ -1169,14 +1169,19 @@ void PlasmaApp::cleanup()
void PlasmaApp::nextPhase()
{
if (m_startupSuspend > 0) {
return;
} else if (m_phase > 0 && !m_klauncherReply.isFinished()) {
kDebug() << "waiting for klauncher reply to finish";
return;
} else if (m_phase > 2 && !m_kdedReply.isFinished()) {
kDebug() << "waiting for kded reply to finish";
return;
if (m_phaseElapsed.elapsed() >= s_phasetimeout) {
kWarning() << "phase took too long, forcing next phase" << m_phaseElapsed.elapsed();
m_startupSuspend = 0;
} else {
if (m_startupSuspend > 0) {
return;
} else if (m_phase > 0 && !m_klauncherReply.isFinished()) {
kDebug() << "waiting for klauncher reply to finish";
return;
} else if (m_phase > 2 && !m_kdedReply.isFinished()) {
kDebug() << "waiting for kded reply to finish";
return;
}
}
kDebug() << "startup phase" << m_phase;
switch (m_phase) {
@ -1194,16 +1199,17 @@ void PlasmaApp::nextPhase()
break;
}
case 3: {
m_phaseTimer->stop();
if (m_sessionManager) {
restoreClients();
}
kDebug() << "startup done";
KNotification::event("kde/startkde");
m_phaseTimer->stop();
break;
}
}
m_phase++;
m_phaseElapsed.start();
}
void PlasmaApp::defaultLogout()

View file

@ -22,6 +22,7 @@
#define PLASMA_APP_H
#include <QTimer>
#include <QElapsedTimer>
#include <QWeakPointer>
#include <QDBusInterface>
#include <QDBusPendingReply>
@ -165,6 +166,7 @@ private:
QHash<int, QWeakPointer<ControllerWindow> > m_widgetExplorers;
QTimer* m_phaseTimer;
int m_phase;
QElapsedTimer m_phaseElapsed;
QDBusPendingReply<void> m_klauncherReply;
QDBusPendingReply<void> m_kdedReply;
QDBusInterface* m_klauncher;