summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qgtkstyle_p.cpp
diff options
context:
space:
mode:
authorThorbjørn Martsum <tmartsum@gmail.com>2013-06-20 12:27:58 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-21 18:59:19 +0200
commitd0e52157295b9ff593dfadc1f9cccab1b4aaa5a0 (patch)
treed9c92a181846d5c58873ef32bb743012e080740c /src/widgets/styles/qgtkstyle_p.cpp
parent6fa9394c8180ca1fe14d7594f4eefd1ca0ba40c7 (diff)
GTK-style - fix non-standard usage of QHash-iterator
Even if it currently works it is highly non standard to modify (incl. free/delete) the key for the iterator and then use it afterwards. The current code prevents a merge of a patch that uses the key to check if the iterator is valid. Change-Id: Ia89553ea4ba53e24488a6bfe06b8d7d0e351c1ea Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/widgets/styles/qgtkstyle_p.cpp')
-rw-r--r--src/widgets/styles/qgtkstyle_p.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp
index 769d822108..c53a21e59a 100644
--- a/src/widgets/styles/qgtkstyle_p.cpp
+++ b/src/widgets/styles/qgtkstyle_p.cpp
@@ -756,8 +756,9 @@ void QGtkStylePrivate::removeWidgetFromMap(const QHashableLatin1Literal &path)
WidgetMap *map = gtkWidgetMap();
WidgetMap::iterator it = map->find(path);
if (it != map->end()) {
- free(const_cast<char *>(it.key().data()));
+ char* keyData = const_cast<char *>(it.key().data());
map->erase(it);
+ free(keyData);
}
}