From 586ed85561ac4a3f936d2b6412625de2e7a0d06b Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 6 Mar 2017 00:12:27 +0000 Subject: [PATCH] Ref/deref DataEngines even if the metadata is invalid Summary: Just because the metadata is invalid doesn't mean the DataEngine actually failed to load, we're still returning a valid object, and as seen with the MPris DataEngine bug. It's important that we still release it properly. It looks like this was designed to make sure you don't delete the null data engine multiple times, but that shouldn't cause an issue here. Test Plan: #plasma Reviewers: #plasma, mart Reviewed By: mart Subscribers: plasma-devel, #frameworks Tags: #plasma, #frameworks Differential Revision: https://phabricator.kde.org/D4556 --- src/plasma/dataengine.cpp | 2 -- src/plasma/dataengineconsumer.cpp | 7 +------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/plasma/dataengine.cpp b/src/plasma/dataengine.cpp index 1c3efb656..dc03b13bd 100644 --- a/src/plasma/dataengine.cpp +++ b/src/plasma/dataengine.cpp @@ -425,8 +425,6 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info, con if (dataEngineDescription.isValid()) { valid = true; e->setObjectName(dataEngineDescription.name()); - } else { - e->setObjectName(QStringLiteral("NullEngine")); } if (dataEngineDescription.isValid()) { diff --git a/src/plasma/dataengineconsumer.cpp b/src/plasma/dataengineconsumer.cpp index f734a9cca..b761aa076 100644 --- a/src/plasma/dataengineconsumer.cpp +++ b/src/plasma/dataengineconsumer.cpp @@ -95,16 +95,11 @@ DataEngine *DataEngineConsumer::dataEngine(const QString &name) DataEngine *engine = DataEngineManager::self()->engine(name); if (engine->isValid()) { return engine; - } else { - d->loadedEngines.remove(name); } } DataEngine *engine = DataEngineManager::self()->loadEngine(name); - if (engine->isValid()) { - d->loadedEngines.insert(name); - } - + d->loadedEngines.insert(name); return engine; }