diff options
| author | Szabolcs David <davidsz@inf.u-szeged.hu> | 2025-02-07 14:34:36 +0100 |
|---|---|---|
| committer | Szabolcs David <davidsz@inf.u-szeged.hu> | 2025-02-24 15:48:47 +0100 |
| commit | 1ffe3392eae1e70f76d621c8a4ee1b20feb004f2 (patch) | |
| tree | c481c718fcb89b5be26b055f681cee481f0e3e15 /src/core/api/qwebenginedownloadrequest.cpp | |
| parent | 815ea62cc2f4a20b8c19e6d62146e07c0876ab19 (diff) | |
Fix QWebEngineDownloadRequest::pause()
Calling pause() (or any method which causes state update) in a directly
connected signal handler of a download request causes an assertion fail
in DownloadItemImpl::UpdateObservers() because it is protected from
nested updates. Use QTimer::singleShot() to detach download requests
and updates from the direct code path.
Add auto test to check if pausing and resuming a download work.
Pick-to: 6.8 6.9
Change-Id: Ia8c977a626fd0d39ca51df42984381a75cca2101
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/api/qwebenginedownloadrequest.cpp')
| -rw-r--r-- | src/core/api/qwebenginedownloadrequest.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/core/api/qwebenginedownloadrequest.cpp b/src/core/api/qwebenginedownloadrequest.cpp index e5b71a071..536d193b7 100644 --- a/src/core/api/qwebenginedownloadrequest.cpp +++ b/src/core/api/qwebenginedownloadrequest.cpp @@ -145,17 +145,13 @@ void QWebEngineDownloadRequestPrivate::update(const ProfileAdapterClient::Downlo downloadState = toDownloadState(info.state); Q_EMIT q->stateChanged(downloadState); } - - if (info.receivedBytes != receivedBytes || info.totalBytes != totalBytes) { - - if (info.receivedBytes != receivedBytes) { - receivedBytes = info.receivedBytes; - Q_EMIT q->receivedBytesChanged(); - } - if (info.totalBytes != totalBytes) { - totalBytes = info.totalBytes; - Q_EMIT q->totalBytesChanged(); - } + if (info.receivedBytes != receivedBytes) { + receivedBytes = info.receivedBytes; + Q_EMIT q->receivedBytesChanged(); + } + if (info.totalBytes != totalBytes) { + totalBytes = info.totalBytes; + Q_EMIT q->totalBytesChanged(); } if (info.done) |
