summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/api/qwebenginedownloaditem.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-16 13:09:44 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-16 17:01:24 +0100
commit819e00f71e37f5230b9b2c2ff756db4cc4cfda5e (patch)
treeed8f247651f06581c462c6cbefde4fa097000946 /src/webenginewidgets/api/qwebenginedownloaditem.cpp
parent9ed734bfdd7b70f4f7f8e78529ead40031607f99 (diff)
parent2620f6baa55dc13d65ea0d4b09a23ddfae580279 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/3rdparty src/core/web_contents_adapter.cpp src/webengine/api/qquickwebengineprofile.cpp src/webenginewidgets/api/qwebengineprofile.cpp tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp Change-Id: I56c093ebab5ee8b577783ce71761719159cd3ddd
Diffstat (limited to 'src/webenginewidgets/api/qwebenginedownloaditem.cpp')
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
index a5569e408..dc1a48360 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
@@ -195,9 +195,10 @@ void QWebEngineDownloadItem::cancel()
// We directly cancel the download request if the user cancels
// before it even started, so no need to notify the profile here.
- if (state == QWebEngineDownloadItem::DownloadInProgress)
- d->profile->browserContext()->cancelDownload(d->downloadId);
- else {
+ if (state == QWebEngineDownloadItem::DownloadInProgress) {
+ if (auto browserContext = d->profile->browserContext())
+ browserContext->cancelDownload(d->downloadId);
+ } else {
d->downloadState = QWebEngineDownloadItem::DownloadCancelled;
Q_EMIT stateChanged(d->downloadState);
}