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
This commit is contained in:
David Edmundson 2017-03-06 00:12:27 +00:00
parent 23b70f4d45
commit 586ed85561
2 changed files with 1 additions and 8 deletions

View File

@ -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()) {

View File

@ -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;
}