summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2017-02-23 15:49:38 +0100
committerAndy Shaw <andy.shaw@qt.io>2017-03-07 08:15:54 +0000
commit7eb11df19e0c0c52b877bc9ded357763bc014316 (patch)
tree59cfde7780b3d46f54ba5e61a670be948c06be0c /tests/auto
parentc0af8cef2ff67e4883b8491224b30a2c3d1f7b17 (diff)
Don't call releaseKey a second time if the insertion fails
When the insertion into the cache fails then it will delete the entry for us which already calls releaseKey(). So we should not call it a second time. Task-number: QTBUG-58259 Change-Id: I816c6f29ef97fe3a245f145c4faf1e0649f72dc5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp
index 8dcf104035..8a2a35f86c 100644
--- a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp
@@ -56,6 +56,7 @@ private slots:
void pixmapKey();
void noLeak();
void strictCacheLimit();
+ void noCrashOnLargeInsert();
};
static QPixmapCache::KeyData* getPrivate(QPixmapCache::Key &key)
@@ -525,5 +526,15 @@ void tst_QPixmapCache::strictCacheLimit()
QVERIFY(QPixmapCache::totalUsed() <= limit);
}
+void tst_QPixmapCache::noCrashOnLargeInsert()
+{
+ QPixmapCache::clear();
+ QPixmapCache::setCacheLimit(100);
+ QPixmap pixmap(500, 500);
+ pixmap.fill(Qt::transparent);
+ QPixmapCache::insert("test", pixmap);
+ QVERIFY(true); // no crash
+}
+
QTEST_MAIN(tst_QPixmapCache)
#include "tst_qpixmapcache.moc"