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:
parent
23b70f4d45
commit
586ed85561
@ -425,8 +425,6 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info, con
|
|||||||
if (dataEngineDescription.isValid()) {
|
if (dataEngineDescription.isValid()) {
|
||||||
valid = true;
|
valid = true;
|
||||||
e->setObjectName(dataEngineDescription.name());
|
e->setObjectName(dataEngineDescription.name());
|
||||||
} else {
|
|
||||||
e->setObjectName(QStringLiteral("NullEngine"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataEngineDescription.isValid()) {
|
if (dataEngineDescription.isValid()) {
|
||||||
|
@ -95,16 +95,11 @@ DataEngine *DataEngineConsumer::dataEngine(const QString &name)
|
|||||||
DataEngine *engine = DataEngineManager::self()->engine(name);
|
DataEngine *engine = DataEngineManager::self()->engine(name);
|
||||||
if (engine->isValid()) {
|
if (engine->isValid()) {
|
||||||
return engine;
|
return engine;
|
||||||
} else {
|
|
||||||
d->loadedEngines.remove(name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DataEngine *engine = DataEngineManager::self()->loadEngine(name);
|
DataEngine *engine = DataEngineManager::self()->loadEngine(name);
|
||||||
if (engine->isValid()) {
|
d->loadedEngines.insert(name);
|
||||||
d->loadedEngines.insert(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user