From d0e52157295b9ff593dfadc1f9cccab1b4aaa5a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Martsum?= Date: Thu, 20 Jun 2013 12:27:58 +0200 Subject: [PATCH] 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 Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qgtkstyle_p.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index 769d822108a..c53a21e59a7 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(it.key().data())); + char* keyData = const_cast(it.key().data()); map->erase(it); + free(keyData); } }