summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Capriotti <paolo@capriotti.io>2019-02-25 14:35:49 +0100
committerFlorian Bruhin <me@the-compiler.org>2019-04-17 12:17:00 +0200
commit6adb610f97e77dfc78ed1e2126b1b45e097f311e (patch)
tree2ba785b46c65fd417fa5a83d7cd7636a9b99e620
parente8e3f369be8d07362f6e74b9141c456247bf0078 (diff)
downloadqutebrowser-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.py11
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())