diff options
author | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2015-06-24 10:31:07 +0200 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2015-06-30 12:27:04 +0000 |
commit | 52e7aba6bf717c673151c9267040c7a90dbea039 (patch) | |
tree | b9bad5de62d3ddca7c9b2b3987c0af6366f7a17c /tests | |
parent | b0852eb2714eac824bff36216b3301f2e02f82a9 (diff) |
QFileIconEngine: Remove reference to QFileIconProvider
Keeping the reference may end up in a crash if a created
QIcon outlives the QFileIconProvider and we then try to
generate a pixmap.
The reference is not necessary since the options are queried
only when creating the icon, so they can be saved in the icon
provider.
Task-number: QTBUG-46755
Change-Id: I5c60887c2ed39030a2a20298ff10fd652189e4e7
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp b/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp index 0bc972d0cb..fba83a24c7 100644 --- a/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp +++ b/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp @@ -58,6 +58,8 @@ private slots: void type_data(); void type(); + + void taskQTBUG_46755_QFileIconEngine_crash(); }; // Subclass that exposes the protected functions. @@ -167,6 +169,21 @@ void tst_QFileIconProvider::type() QVERIFY(!provider.type(info).isEmpty()); } +static QIcon getIcon() +{ + QFileIconProvider fip; + return fip.icon(QDir::currentPath()); +} + +void tst_QFileIconProvider::taskQTBUG_46755_QFileIconEngine_crash() +{ + const QIcon &icon = getIcon(); + foreach (const QSize &size, icon.availableSizes()) + icon.pixmap(size); + + // No crash, all good. +} + QTEST_MAIN(tst_QFileIconProvider) #include "tst_qfileiconprovider.moc" |