Fix exception when quitting with download prompt open
If we have a pending download with a prompt and quit qutebrowser, we get:
mainwindow:closeEvent:715 Closing window 0
quitter:shutdown:221 Shutting down with status 0, session None...
prompt:shutdown:121 Shutting down with loops [<qutebrowser.utils.qtutils.EventLoop object at 0x7fa034725770>]
quitter:shutdown:235 Deferring shutdown stage 2
prompt:ask_question:179 Ending loop.exec() for <qutebrowser.utils.usertypes.Question default='/tmp/qbdl/download/' mode=<PromptMode.download: 5> option=None text='Please enter a location for <b>https://proof.ovh.net/files/1Mb.dat</b>' title='Save file to:'>
prompt:ask_question:181 Restoring old question None
prompt:_on_show_prompts:299 Deleting old prompt qutebrowser.mainwindow.prompt.DownloadFilenamePrompt(question=<qutebrowser.utils.usertypes.Question default='/tmp/qbdl/download/' mode=<PromptMode.download: 5> option=None text='Please enter a location for <b>https://proof.ovh.net/files/1Mb.dat</b>' title='Save file to:'>)
prompt:_on_show_prompts:303 No prompts left, hiding prompt container.
objreg:on_destroyed:112 schedule removal: 0
objreg:on_destroyed:112 schedule removal: tab
[...]
objreg:on_destroyed:112 schedule removal: 0
objreg:on_destroyed:112 schedule removal: main-window
objreg:on_destroyed:112 schedule removal: tabbed-browser
objreg:on_destroyed:112 schedule removal: status-command
objreg:on_destroyed:112 schedule removal: completion
objreg:on_destroyed:112 schedule removal: mode-manager
objreg:on_destroyed:112 schedule removal: hintmanager
objreg:on_destroyed:112 schedule removal: prompt-container
quitter:_shutdown_2:241 Stage 2 of shutting down...
[...]
webenginedownloads:_on_state_changed:63 State for <qutebrowser.browser.webengine.webenginedownloads.DownloadItem basename='1Mb.dat'> changed to DownloadCancelled
downloads:_on_begin_remove_row:1076 _on_begin_remove_row with idx 0, webengine True
downloads:_remove_item:995 Removed download 1: 1Mb.dat [100%|?.??B]
modeman:leave:429 Leaving mode KeyMode.prompt (reason: aborted)
crashsignal:_handle_early_exits:229 Uncaught exception
Traceback (most recent call last):
File "[...]/qutebrowser/mainwindow/prompt.py", line 344, in _on_aborted
modeman.leave(self._win_id, key_mode, 'aborted', maybe=True)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]/qutebrowser/keyinput/modeman.py", line 214, in leave
instance(win_id).leave(mode, reason, maybe=maybe)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]/qutebrowser/keyinput/modeman.py", line 435, in leave
self.left.emit(mode, self.mode, self._win_id)
^^^^^^^^^
RuntimeError: wrapped C/C++ object of type ModeManager has been deleted
This commit is contained in:
parent
c6b486ce81
commit
a13306a79f
|
|
@ -342,9 +342,9 @@ class PromptContainer(QWidget):
|
|||
"""Leave KEY_MODE whenever a prompt is aborted."""
|
||||
try:
|
||||
modeman.leave(self._win_id, key_mode, 'aborted', maybe=True)
|
||||
except objreg.RegistryUnavailableError:
|
||||
except (objreg.RegistryUnavailableError, RuntimeError):
|
||||
# window was deleted: ignore
|
||||
pass
|
||||
log.prompt.debug(f"Ignoring leaving {key_mode} as window was deleted")
|
||||
|
||||
@pyqtSlot(usertypes.KeyMode)
|
||||
def _on_prompt_done(self, key_mode):
|
||||
|
|
|
|||
|
|
@ -129,6 +129,14 @@ Feature: Downloading things from a website.
|
|||
And I wait for "Download drip finished" in the log
|
||||
Then the downloaded file drip should be 128 bytes big
|
||||
|
||||
Scenario: Shutting down with a download question
|
||||
When I set downloads.location.prompt to true
|
||||
And I open data/downloads/download.bin without waiting
|
||||
And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=<PromptMode.download: 5> option=None text='Please enter a location for <b>http://localhost:*/data/downloads/download.bin</b>' title='Save file to:'>, *" in the log
|
||||
And I run :close
|
||||
Then qutebrowser should quit
|
||||
# (and no crash should happen)
|
||||
|
||||
Scenario: Downloading a file with spaces
|
||||
When I open data/downloads/download with spaces.bin without waiting
|
||||
And I wait until the download is finished
|
||||
|
|
|
|||
Loading…
Reference in New Issue