diff --git a/qutebrowser/mainwindow/prompt.py b/qutebrowser/mainwindow/prompt.py index 3f618a279..c8045c0e8 100644 --- a/qutebrowser/mainwindow/prompt.py +++ b/qutebrowser/mainwindow/prompt.py @@ -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): diff --git a/tests/end2end/features/downloads.feature b/tests/end2end/features/downloads.feature index df04625a8..369befa99 100644 --- a/tests/end2end/features/downloads.feature +++ b/tests/end2end/features/downloads.feature @@ -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 option=None text='Please enter a location for http://localhost:*/data/downloads/download.bin' 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