From 0e9ea9451174aeeb78f41f0cc213373e8ce76e5a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 19 Jul 2017 12:37:24 +0200 Subject: QPMCache::remove(): Do not dereference erased iterator Fixes a crash in tst_QGL::textureCleanup() (developer build). Amends 467b15a20c3d6eb611ea5f6ccffd5fc0df81b0c4. Change-Id: I7026b3c2a27c02a80b995fde67a832dc2d19031d Reviewed-by: Allan Sandfeld Jensen --- src/gui/image/qpixmapcache.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 625e145647..742aa31ba9 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -383,8 +383,9 @@ bool QPMCache::remove(const QString &key) //The key was not in the cache if (cacheKey == cacheKeys.constEnd()) return false; + const bool result = QCache::remove(cacheKey.value()); cacheKeys.erase(cacheKey); - return QCache::remove(cacheKey.value()); + return result; } bool QPMCache::remove(const QPixmapCache::Key &key) -- cgit v1.2.3