summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-01-16 17:30:56 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-01-21 10:06:01 +0000
commit0deb1ffda77f0410b3d13419856c757cdd422d2b (patch)
tree9206e32b8b23f7b8df827ec051182dbfc96d80af /src/webenginewidgets
parent3f7ea91e23d82e676aeaf157736e25cf54e5ec6b (diff)
Remove download items internally when API objects are deleted
We were never removing internal download item. [ChangeLog][Behavioral Changes] Deleting a download item will now also cancel it if it is still in progress. Change-Id: I2fab497d7acf7ca6ca17f4a61e106b1c18bfb333 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
index fc27e104d..55d4fcca8 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
@@ -141,8 +141,8 @@ static inline QWebEngineDownloadItem::DownloadInterruptReason toDownloadInterrup
QWebEngineProfile being a long-lived object, it is in fact recommended that
the application delete any items it is no longer interested in.
- \note Deleting an item will not cancel a possible ongoing download. If that
- is desirable, then cancel() must be called separately.
+ \note Deleting an item will also automatically cancel a download since 5.12.2,
+ but it is recommended to cancel manually before deleting for portability.
\section2 Web Page Downloads
@@ -653,6 +653,8 @@ QWebEngineDownloadItem::QWebEngineDownloadItem(QWebEngineDownloadItemPrivate *p,
*/
QWebEngineDownloadItem::~QWebEngineDownloadItem()
{
+ if (auto profileAdapter = d_ptr->profile->profileAdapter())
+ profileAdapter->removeDownload(d_ptr->downloadId);
}
QT_END_NAMESPACE