Commit 6e37f303 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Don't create multiple in-process backend instances

Summary:
The 'name' argument is in most cases empty by which the caller indicates that
they want the default backend. As such repeated calls to loadBackendInProcess(QString())
cause to instantiate a new backend every time, because the name check in the
condition is never true.

Reviewers: sebas, davidedmundson

Reviewed By: davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9905
parent 4abdc5b1
......@@ -226,7 +226,7 @@ KScreen::AbstractBackend *BackendManager::loadBackendInProcess(const QString &na
qCWarning(KSCREEN) << "You are trying to load a backend in process, while the BackendManager is set to use OutOfProcess communication. Use loadBackendPlugin() instead.";
return nullptr;
}
if (m_inProcessBackend.first != nullptr && m_inProcessBackend.first->name() == name) {
if (m_inProcessBackend.first != nullptr && (name.isEmpty() || m_inProcessBackend.first->name() == name)) {
return m_inProcessBackend.first;
} else if (m_inProcessBackend.first != nullptr && m_inProcessBackend.first->name() != name) {
shutdownBackend();
......
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