diff options
author | Paolo Capriotti <paolo@capriotti.io> | 2019-02-25 14:35:49 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2019-04-17 12:17:00 +0200 |
commit | 6adb610f97e77dfc78ed1e2126b1b45e097f311e (patch) | |
tree | 2ba785b46c65fd417fa5a83d7cd7636a9b99e620 | |
parent | e8e3f369be8d07362f6e74b9141c456247bf0078 (diff) | |
download | qutebrowser-6adb610f97e77dfc78ed1e2126b1b45e097f311e.tar.gz qutebrowser-6adb610f97e77dfc78ed1e2126b1b45e097f311e.zip |
Fix crash when closing prompt
If a window is closed when a prompt is displayed on all windows, leaving prompt
mode later would cause a crash.
This patch fixes the crash simply by ignoring the RegistryUnavailableError
caused by looking up a non-existent window.
Fixes #3378.
-rw-r--r-- | qutebrowser/mainwindow/prompt.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/qutebrowser/mainwindow/prompt.py b/qutebrowser/mainwindow/prompt.py index 4f9457acd..166e3f283 100644 --- a/qutebrowser/mainwindow/prompt.py +++ b/qutebrowser/mainwindow/prompt.py @@ -331,9 +331,14 @@ class PromptContainer(QWidget): if not question.interrupted: # If this question was interrupted, we already connected the signal - question.aborted.connect( - lambda: modeman.leave(self._win_id, prompt.KEY_MODE, 'aborted', - maybe=True)) + def on_aborted(): + try: + modeman.leave(self._win_id, prompt.KEY_MODE, + 'aborted', maybe=True) + except objreg.RegistryUnavailableError: + # window was deleted: ignore + pass + question.aborted.connect(on_aborted) modeman.enter(self._win_id, prompt.KEY_MODE, 'question asked') self.setSizePolicy(prompt.sizePolicy()) |