From 86e74d75dfceb4d70802861258763ece61bdb40b Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 27 Oct 2020 00:15:36 +0000 Subject: [PATCH] [plasma-session] Fix application lifespan We want to last until all jobs are finished and the notification sound thread has finished. The design intention was to let QEventLoopLocker handle all of it implicitly, but that doesn't work when we call quit explicitly. BUG: 422948 --- startkde/plasma-session/startup.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/startkde/plasma-session/startup.cpp b/startkde/plasma-session/startup.cpp index c79e63b91..32dcfccc2 100644 --- a/startkde/plasma-session/startup.cpp +++ b/startkde/plasma-session/startup.cpp @@ -150,8 +150,6 @@ class NotificationThread : public QThread { Q_OBJECT void run() override { - // Prevent application exit until the thread (and hence the sound) completes - QEventLoopLocker(this); // We cannot parent to the thread itself so let's create // a QObject on the stack and parent everythign to it QObject parent; @@ -196,6 +194,9 @@ class NotificationThread : public QThread m->play(); exec(); } +private: + // Prevent application exit until the thread (and hence the sound) completes + QEventLoopLocker m_locker; }; @@ -261,6 +262,8 @@ Startup::Startup(QObject *parent): connect(sequence.last(), &KJob::finished, this, &Startup::finishStartup); sequence.first()->start(); + + // app will be closed when all KJobs finish thanks to the QEventLoopLocker in each KJob } void Startup::upAndRunning( const QString& msg ) @@ -277,7 +280,6 @@ void Startup::finishStartup() { qCDebug(PLASMA_SESSION) << "Finished"; upAndRunning(QStringLiteral("ready")); - qApp->quit(); } void Startup::updateLaunchEnv(const QString &key, const QString &value)