From 0b18d4f0b38c78bbdd62cf4cf6470ad50aa25911 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 30 May 2019 15:38:20 +0200 Subject: [PATCH] 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 --- src/plasma/private/storagethread.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plasma/private/storagethread.cpp b/src/plasma/private/storagethread.cpp index 43bc91c10..a6d0fce8e 100644 --- a/src/plasma/private/storagethread.cpp +++ b/src/plasma/private/storagethread.cpp @@ -110,9 +110,12 @@ void StorageThread::save(QPointer wcaller, const QVariantMap ¶ms 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 it(caller->data());