Commit 4e681fdb authored by David Edmundson's avatar David Edmundson

[plasma-session] Don't prematurely cache systemEnvironemnt

Summary:
plasma-session goes to great lengths to make sure we have the latest env
vars from kcminit in future spawned jobs.

However one part got broke in some refactor, we capture the system
environment when we make the job, not when we're about to launch.

This means potentially kded5 and ksmserver wouldn't have the envs
kcminit set.

I've not noticed any practical impact from this.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28626
parent 55400729
......@@ -421,12 +421,10 @@ StartServiceJob::StartServiceJob(const QString &process, const QStringList &args
: KJob()
, m_process(new QProcess(this))
, m_serviceId(serviceId)
, m_additionalEnv(additionalEnv)
{
m_process->setProgram(process);
m_process->setArguments(args);
auto env = QProcessEnvironment::systemEnvironment();
env.insert(additionalEnv);
m_process->setProcessEnvironment(env);
auto watcher = new QDBusServiceWatcher(serviceId, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration, this);
connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &StartServiceJob::emitResult);
......@@ -434,6 +432,10 @@ StartServiceJob::StartServiceJob(const QString &process, const QStringList &args
void StartServiceJob::start()
{
auto env = QProcessEnvironment::systemEnvironment();
env.insert(m_additionalEnv);
m_process->setProcessEnvironment(env);
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(m_serviceId)) {
qCDebug(PLASMA_SESSION) << m_process << "already running";
emitResult();
......
......@@ -109,6 +109,7 @@ public:
private:
QProcess* m_process;
const QString m_serviceId;
const QProcessEnvironment m_additionalEnv;
};
class RestoreSessionJob: public KJob
......
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