diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2015-03-16 17:46:57 +0100 |
---|---|---|
committer | Albert Astals Cid <albert.astals@canonical.com> | 2015-03-30 18:14:35 +0000 |
commit | 6e6a2166bad585fcd2f2c26aaf0b2a7ba41e8cd4 (patch) | |
tree | 195cbc41b55f48600e7c4f59c9dc15cdc65c410d /src/quick/util/qquickpixmapcache.cpp | |
parent | d2b08bfdb5b81b4c6f90852b053a487a0bffd348 (diff) |
Always remove reply from replies when processing cancelled
Otherwise we if we leave the entry in replies later
QQuickPixmapReader::networkRequestDone
will give a potentially already deleted pointer in replies.take(reply)
which will then crash when trying to post something to it
Change-Id: I157a58e3ebe0a3fd6422742843eafbbdc58a7801
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'src/quick/util/qquickpixmapcache.cpp')
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 22ed9b7486..42e6b818fb 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -522,10 +522,12 @@ void QQuickPixmapReader::processJobs() for (int i = 0; i < cancelled.count(); ++i) { QQuickPixmapReply *job = cancelled.at(i); QNetworkReply *reply = replies.key(job, 0); - if (reply && reply->isRunning()) { - // cancel any jobs already started + if (reply) { replies.remove(reply); - reply->close(); + if (reply->isRunning()) { + // cancel any jobs already started + reply->close(); + } } PIXMAP_PROFILE(pixmapStateChanged<QQuickProfiler::PixmapLoadingError>(job->url)); // deleteLater, since not owned by this thread |