Commit e67dc48a authored by David Edmundson's avatar David Edmundson
Browse files

[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


(cherry picked from commit 86e74d75)
parent 595ec030
......@@ -151,8 +151,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;
......@@ -197,6 +195,9 @@ class NotificationThread : public QThread
m->play();
exec();
}
private:
// Prevent application exit until the thread (and hence the sound) completes
QEventLoopLocker m_locker;
};
......@@ -262,6 +263,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 )
......@@ -278,7 +281,6 @@ void Startup::finishStartup()
{
qCDebug(PLASMA_SESSION) << "Finished";
upAndRunning(QStringLiteral("ready"));
qApp->quit();
}
void Startup::updateLaunchEnv(const QString &key, const QString &value)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment