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 crash when unbinding key from a section which doesn't exist in the config
|
||||||
- Fixed report window after a segfault
|
- Fixed report window after a segfault
|
||||||
- Fixed some directory browser issues on Windows
|
- Fixed some directory browser issues on Windows
|
||||||
|
- Fixed crash when closing a window with a finished download and delayed
|
||||||
|
`remove-finished-downloads` setting.
|
||||||
|
|
||||||
Removed
|
Removed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -27,6 +27,7 @@ import shutil
|
|||||||
import functools
|
import functools
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
|
import sip
|
||||||
from PyQt5.QtCore import (pyqtSlot, pyqtSignal, QObject, QTimer,
|
from PyQt5.QtCore import (pyqtSlot, pyqtSignal, QObject, QTimer,
|
||||||
Qt, QVariant, QAbstractListModel, QModelIndex, QUrl)
|
Qt, QVariant, QAbstractListModel, QModelIndex, QUrl)
|
||||||
from PyQt5.QtGui import QDesktopServices
|
from PyQt5.QtGui import QDesktopServices
|
||||||
@ -1130,6 +1131,9 @@ class DownloadManager(QAbstractListModel):
|
|||||||
|
|
||||||
def remove_item(self, download):
|
def remove_item(self, download):
|
||||||
"""Remove a given download."""
|
"""Remove a given download."""
|
||||||
|
if sip.isdeleted(self):
|
||||||
|
# https://github.com/The-Compiler/qutebrowser/issues/1242
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
idx = self.downloads.index(download)
|
idx = self.downloads.index(download)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -161,3 +161,13 @@ Feature: Downloading things from a website.
|
|||||||
When I run :download http://localhost:(port)/drip?numbytes=128&duration=5
|
When I run :download http://localhost:(port)/drip?numbytes=128&duration=5
|
||||||
And I run :download-open with count 1
|
And I run :download-open with count 1
|
||||||
Then the error "Download 1 is not done!" should be shown
|
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