From 85c61bb108f095075f73f14c7a704ed17ba9109d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 6 Apr 2016 15:12:30 +0200 Subject: Fix handling of unaccepted downloads in QtQuick API Like in the QWidget API we must discard unaccepted download items. The QtQuick minimal example asserted when triggering the save web action twice, because the download item of the first (unhandled) save operation was still in the list of ongoing downloads. Task-number: QTBUG-52370 Change-Id: I23b1990f8fa5082121f7c75927039b7959c28700 Reviewed-by: Kai Koehne --- src/webengine/api/qquickwebengineprofile.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/webengine') diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 598f4861e..b3ed5a62f 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -193,6 +193,13 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) info.savePageFormat = itemPrivate->savePageFormat; info.accepted = state != QQuickWebEngineDownloadItem::DownloadCancelled && state != QQuickWebEngineDownloadItem::DownloadRequested; + + if (state == QQuickWebEngineDownloadItem::DownloadRequested) { + // Delete unaccepted downloads. + info.accepted = false; + m_ongoingDownloads.remove(info.id); + delete download; + } } void QQuickWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info) -- cgit v1.2.3