diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-08-12 02:38:53 (GMT) |
---|---|---|
committer | Toby Tomkins <toby.tomkins@nokia.com> | 2010-08-18 12:20:59 (GMT) |
commit | 279c5eb3bd7c8bb836f2a3f8f5a0b1dc046dc24a (patch) | |
tree | ec4766e1f962e06135cfbe9d7573e237bd050d5d | |
parent | 1ddbd9a855926d17e7de86c993a5f7d9e57c3401 (diff) | |
download | Qt-279c5eb3bd7c8bb836f2a3f8f5a0b1dc046dc24a.zip Qt-279c5eb3bd7c8bb836f2a3f8f5a0b1dc046dc24a.tar.gz Qt-279c5eb3bd7c8bb836f2a3f8f5a0b1dc046dc24a.tar.bz2 |
Only modify pixmap cache reply when protected by a mutex
QTBUG-12729
(cherry picked from commit ee7c3b576ced47d3b68da1913cdf6995144bddd2)
-rw-r--r-- | src/declarative/util/qdeclarativepixmapcache.cpp | 2 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index 9ced14f..de2de21 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -525,6 +525,7 @@ void QDeclarativePixmapReader::cancel(QDeclarativePixmapReply *reply) mutex.lock(); if (reply->loading) { cancelled.append(reply); + reply->data = 0; // XXX if (threadObject) threadObject->processJobs(); } else { @@ -738,7 +739,6 @@ void QDeclarativePixmapData::release() if (refCount == 0) { if (reply) { - reply->data = 0; reply->reader->cancel(reply); reply = 0; } diff --git a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp index 16d2063..6b36224 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp +++ b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp @@ -71,6 +71,7 @@ private slots: void parallel(); void parallel_data(); void massive(); + void cancelcrash(); private: QDeclarativeEngine engine; @@ -316,6 +317,15 @@ void tst_qdeclarativepixmapcache::massive() } } +// QTBUG-12729 +void tst_qdeclarativepixmapcache::cancelcrash() +{ + QUrl url("http://127.0.0.1:14452/cancelcrash_notexist.png"); + for (int ii = 0; ii < 1000; ++ii) { + QDeclarativePixmap pix(&engine, url); + } +} + QTEST_MAIN(tst_qdeclarativepixmapcache) #include "tst_qdeclarativepixmapcache.moc" |