summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2020-11-02 17:21:30 +0100
committerFlorian Bruhin <me@the-compiler.org>2020-11-02 17:21:30 +0100
commit0918c9e85eb8606f33d069ee87e49299e0092e8b (patch)
tree25c83d3c45b502d88398091b49a9a51b4b3af7e3
parentf5a25c429b64a55e57d801862b872289409c281d (diff)
downloadqutebrowser-0918c9e85eb8606f33d069ee87e49299e0092e8b.tar.gz
qutebrowser-0918c9e85eb8606f33d069ee87e49299e0092e8b.zip
Make sure we don't cancel downloads which are done
With b997220c3c2976a71a45c42509ea55db2762749d, we introduced code which calls .cancel() on all downloads on shutdown. However, this includes downloads which were already finished, causing their finished signal to be emitted a second time. Combined with 4cd255c7372625b4c3a630844ffd2b42d6ddde58, this caused #5849 (though there might be other ways to reproduce?): - Window is shutting down, thus not available via objreg anymore - Downloads get cancelled - Completed PDF downloads emit finished again - PDFjs tries to open again, but no window is available anymore (partial cherry pick from 5eabf460b9709c62a6535bc8eda52c2141177cb2, but with potentially regressing assertions removed)
-rw-r--r--qutebrowser/browser/downloads.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py
index 3c3932c5f..6f46a1d57 100644
--- a/qutebrowser/browser/downloads.py
+++ b/qutebrowser/browser/downloads.py
@@ -981,7 +981,8 @@ class AbstractDownloadManager(QObject):
def shutdown(self):
"""Cancel all downloads when shutting down."""
for download in self.downloads:
- download.cancel(remove_data=False)
+ if not download.done:
+ download.cancel(remove_data=False)
class DownloadModel(QAbstractListModel):