Fix crash when removing download in closed window
When a download is finished with `removed-finished-download` set to a delay, it's removed via a singleshot QTimer. However, when the window was closed in the meantime, the slot still was executed by Qt, even though the DownloadManager was already deleted. Fixes #1242
This commit is contained in:
parent
305c8a2f03
commit
123fd18af5
@ -70,6 +70,8 @@ Fixed
|
||||
- Fixed crash when unbinding key from a section which doesn't exist in the config
|
||||
- Fixed report window after a segfault
|
||||
- Fixed some directory browser issues on Windows
|
||||
- Fixed crash when closing a window with a finished download and delayed
|
||||
`remove-finished-downloads` setting.
|
||||
|
||||
Removed
|
||||
~~~~~~~
|
||||
|
@ -27,6 +27,7 @@ import shutil
|
||||
import functools
|
||||
import collections
|
||||
|
||||
import sip
|
||||
from PyQt5.QtCore import (pyqtSlot, pyqtSignal, QObject, QTimer,
|
||||
Qt, QVariant, QAbstractListModel, QModelIndex, QUrl)
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
@ -1130,6 +1131,9 @@ class DownloadManager(QAbstractListModel):
|
||||
|
||||
def remove_item(self, download):
|
||||
"""Remove a given download."""
|
||||
if sip.isdeleted(self):
|
||||
# https://github.com/The-Compiler/qutebrowser/issues/1242
|
||||
return
|
||||
try:
|
||||
idx = self.downloads.index(download)
|
||||
except ValueError:
|
||||
|
@ -161,3 +161,13 @@ Feature: Downloading things from a website.
|
||||
When I run :download http://localhost:(port)/drip?numbytes=128&duration=5
|
||||
And I run :download-open with count 1
|
||||
Then the error "Download 1 is not done!" should be shown
|
||||
|
||||
## https://github.com/The-Compiler/qutebrowser/issues/1242
|
||||
|
||||
Scenario: Closing window with remove-finished-downloads timeout
|
||||
When I set ui -> remove-finished-downloads to 500
|
||||
And I open data/downloads/download.bin in a new window
|
||||
And I wait until the download is finished
|
||||
And I run :close
|
||||
And I wait 0.5s
|
||||
Then no crash should happen
|
||||
|
Loading…
Reference in New Issue
Block a user