aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Shaforostov <mshaforostov@airmusictech.com>2020-11-06 18:38:20 +0100
committerUlf Hermann <ulf.hermann@qt.io>2023-09-09 06:04:53 +0000
commit335e2f005f1f604c670e1bb602280966b7739c3b (patch)
treed0f41b1dc439100408511d6061be0f712cb2a591
parent7573e764f7cad6f6b379f8739618d959a171b033 (diff)
pixmapcache: avoid deadlock when canceling async image load
was only possible if qml_network is disabled Change-Id: If8a8addc0aa5c4c768dd7df3aa4d627f82a78059 Reviewed-by: Lorn Potter <lorn.potter@gmail.com> (cherry picked from commit da9b9a4e6e2cddd6dd1dbf2e126fc2d332bc0616) Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r--src/quick/util/qquickpixmapcache.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index fd69079c55..4afa16ca33 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -698,9 +698,9 @@ void QQuickPixmapReader::processJobs()
// Clean cancelled jobs
if (!cancelled.isEmpty()) {
-#if QT_CONFIG(qml_network)
for (int i = 0; i < cancelled.count(); ++i) {
QQuickPixmapReply *job = cancelled.at(i);
+#if QT_CONFIG(qml_network)
QNetworkReply *reply = networkJobs.key(job, 0);
if (reply) {
networkJobs.remove(reply);
@@ -709,6 +709,9 @@ void QQuickPixmapReader::processJobs()
reply->close();
}
} else {
+#else
+ {
+#endif
QQuickImageResponse *asyncResponse = asyncResponses.key(job);
if (asyncResponse) {
asyncResponses.remove(asyncResponse);
@@ -720,7 +723,6 @@ void QQuickPixmapReader::processJobs()
job->deleteLater();
}
cancelled.clear();
-#endif
}
if (!jobs.isEmpty()) {