summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edmundson <[email protected]>2017-04-27 15:52:39 +0100
committerDavid Edmundson <[email protected]>2017-04-27 15:53:19 +0100
commitea3f87c5df0251838da71c473fd7b790c932d8b0 (patch)
treed6325b7d02bc82e44d6b63cecfcf89be5debf723
parentf78b0869f01d255d0e17a0a246e5a9456f2bba4e (diff)
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
-rw-r--r--ksmserver/startup.cpp17
1 files 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.
}