Don't modify a temporary object

Summary: Instead copy the object, operate it and update it into the object.

Test Plan:
just used plasma shell and ran the tests. I'm not sure who uses this.
Issue found with clazy.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D21483
This commit is contained in:
Aleix Pol 2019-05-30 15:38:20 +02:00
parent f631aec33f
commit 0b18d4f0b3

View File

@ -110,9 +110,12 @@ void StorageThread::save(QPointer<StorageJob> wcaller, const QVariantMap &params
valueGroup = QStringLiteral("default");
}
QSqlQuery query(m_db);
QVariantMap data = caller->data();
if (params.value(QStringLiteral("key")).toString().isNull()) {
caller->data().insert(params.value(QStringLiteral("key")).toString(), params.value(QStringLiteral("data")));
data.insert(params.value(QStringLiteral("key")).toString(), params.value(QStringLiteral("data")));
}
caller->setData(data);
QMapIterator<QString, QVariant> it(caller->data());