From 0deb1ffda77f0410b3d13419856c757cdd422d2b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 16 Jan 2019 17:30:56 +0100 Subject: Remove download items internally when API objects are deleted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/webenginewidgets/api/qwebenginedownloaditem.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/webenginewidgets/api') 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 -- cgit v1.2.3