Commit 4abdc5b1 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Wayland: don't share the same Config between backend and clients

Summary:
Sharing a single config leads to undesired side-effects. The GetConfigOperation
is assumed to always return a new copy of the current config that is not changed
unless registered to ConfigMonitor. When sharing a single copy this assumption is
broken which leads to misbehaviour in KDED.

This change makes GetConfigOperation always return a new copy of the config that
caller can register to ConfigMonitor if they want to, otherwise it remains
unchanged until released.

Reviewers: sebas, davidedmundson

Reviewed By: sebas

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9904
parent 0dc788c2
......@@ -244,6 +244,7 @@ KScreen::AbstractBackend *BackendManager::loadBackendInProcess(const QString &na
//qCDebug(KSCREEN) << "Connecting ConfigMonitor to backend.";
ConfigMonitor::instance()->connectInProcessBackend(backend);
m_inProcessBackend = qMakePair<KScreen::AbstractBackend*, QVariantMap>(backend, arguments);
setConfig(backend->config());
return backend;
}
......
......@@ -167,7 +167,6 @@ void ConfigMonitor::Private::edidReady(QDBusPendingCallWatcher* watcher)
void ConfigMonitor::Private::updateConfigs(const KScreen::ConfigPtr &newConfig)
{
Q_ASSERT(BackendManager::instance()->method() == BackendManager::OutOfProcess);
QMutableListIterator<QWeakPointer<Config>> iter(watchedConfigs);
while (iter.hasNext()) {
KScreen::ConfigPtr config = iter.next().toStrongRef();
......@@ -247,10 +246,8 @@ void ConfigMonitor::connectInProcessBackend(KScreen::AbstractBackend* backend)
if (config.isNull()) {
return;
}
const QWeakPointer<Config> weakConfig = config.toWeakRef();
if (d->watchedConfigs.contains(weakConfig)) {
emit configurationChanged();
}
qCDebug(KSCREEN) << "Backend change!" << config;
d->updateConfigs(config);
});
}
......
......@@ -171,8 +171,7 @@ void GetConfigOperation::start()
Q_D(GetConfigOperation);
if (BackendManager::instance()->method() == BackendManager::InProcess) {
auto backend = d->loadBackend();
d->config = backend->config();
KScreen::BackendManager::instance()->setConfig(d->config);
d->config = backend->config()->clone();
d->loadEdid(backend);
emitResult();
} else {
......
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