From 88d8e35ccbb70da766a24fa2b985a09b046549bc Mon Sep 17 00:00:00 2001 From: MohammadHossein Qanbari Date: Thu, 27 Jun 2024 18:41:19 +0200 Subject: [PATCH] Use QFlatMap::operator[] when the reference value is needed The QGtk3Json::save() function does not save the palettes properly. The bug was occurring as the QFlatMap::value() method returns a copy of the value stored in the object. To fix this bug, the QFlatMap::operator[] operator is used as it returns a reference to the value. Then the update happens on the original value in the QFlatMap object. Pick-to: 6.7 6.5 Change-Id: Ib6f9e350f5447027de4d0a8e6cb8a84012ea8990 Reviewed-by: Santhosh Kumar (cherry picked from commit e17245505ea4ae2bdc05608114586bc5fa933d58) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platformthemes/gtk3/qgtk3json.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platformthemes/gtk3/qgtk3json.cpp b/src/plugins/platformthemes/gtk3/qgtk3json.cpp index eb81e563be4..a5af2ae9af8 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3json.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3json.cpp @@ -154,7 +154,7 @@ const QJsonDocument QGtk3Json::save(const QGtk3Storage::PaletteMap &map) ++brushIterator) { const QPalette::ColorRole role = brushIterator.key().colorRole; if (brushMaps.contains(role)) { - brushMaps.value(role).insert(brushIterator.key(), brushIterator.value()); + brushMaps[role].insert(brushIterator.key(), brushIterator.value()); } else { QGtk3Storage::BrushMap newMap; newMap.insert(brushIterator.key(), brushIterator.value());