plasma5-workspace/revert-autostart-krun.patch

83 lines
2.6 KiB
Diff
Raw Normal View History

From ea3f87c5df0251838da71c473fd7b790c932d8b0 Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Thu, 27 Apr 2017 15:52:39 +0100
Subject: Revert "launch autostart apps in ksmserver using KRun"
KRun::runApplication will show blocking error dialogs if it fails to
find the executable
This means we don't autostart the next app, which could be fatal if it
comes before...
Summary:
...kwin/plasma
We shouldn't be having blocking calls in ksmserver it can deadlock
And even in the best case we'd still end up blocking ksplash for 30
seconds
We then port to KProcess which was part of the motivation behind the
patch as it
has better stdout handling
This reverts commit 0f19e92f3e85d064de9cebf280fa8e085485c2e0.
BUG: 379254
Also added port of autostarting applications to KProcess
It has better stdout handling
Test Plan: Logged in, still got my main session
Reviewers: #plasma, mart
Reviewed By: mart
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D5618
---
ksmserver/startup.cpp | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/ksmserver/startup.cpp b/ksmserver/startup.cpp
index e51278b..767116d 100644
--- a/ksmserver/startup.cpp
+++ b/ksmserver/startup.cpp
@@ -68,9 +68,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <kconfig.h>
#include <kconfiggroup.h>
+#include <kio/desktopexecparser.h>
#include <KSharedConfig>
#include <kprocess.h>
-#include <krun.h>
#include <KNotifyConfig>
#include <KService>
@@ -679,8 +679,19 @@ void KSMServer::slotAutoStart()
}
KService service(serviceName);
qCInfo(KSMSERVER) << "Starting autostart service " << serviceName;
- if( !KRun::runApplication( service, QList<QUrl>(), nullptr, KRun::RunFlags(), QString(), "0" ))
- qCInfo(KSMSERVER) << "autostart service" << serviceName << "failed to launch";
+ auto p = new KProcess(this);
+ auto arguments = KIO::DesktopExecParser(service, QList<QUrl>()).resultingArguments();
+ if (arguments.isEmpty()) {
+ qCInfo(KSMSERVER) << "failed to parse" << serviceName << "for autostart";
+ continue;
+ }
+ auto program = arguments.takeFirst();
+ p->setProgram(program, arguments);
+ p->start();
+ connect(p, static_cast<void (QProcess::*)(int)>(&QProcess::finished), [p](int exitCode) {
+ qCInfo(KSMSERVER) << "autostart service" << p->program() << "finished with exit code " << exitCode;
+ p->deleteLater();
+ });
} while (true);
// Loop till we find a service that we can start.
}
--
cgit v0.11.2