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>
This commit is contained in:
Thorbjørn Martsum 2013-06-20 12:27:58 +02:00 committed by The Qt Project
parent 6fa9394c81
commit d0e5215729

View File

@ -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);
}
}