diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-08-12 02:38:53 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-08-12 02:38:53 (GMT) |
commit | ee7c3b576ced47d3b68da1913cdf6995144bddd2 (patch) | |
tree | fd0011bb4c7125c811a1acd7b5c65da4eed97a6c | |
parent | 59d36ea601aef6182cba0e0f5fc56cc102e29c59 (diff) | |
download | Qt-ee7c3b576ced47d3b68da1913cdf6995144bddd2.zip Qt-ee7c3b576ced47d3b68da1913cdf6995144bddd2.tar.gz Qt-ee7c3b576ced47d3b68da1913cdf6995144bddd2.tar.bz2 |
Only modify pixmap cache reply when protected by a mutex
QTBUG-12729
-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" |