From 162e6d6483476bb81f44b6d8a88a93fd2cb0fd2b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 11 Sep 2016 15:59:50 +0200 Subject: [PATCH] Fix closing with no last-visible-main-window Fixes #1918 --- CHANGELOG.asciidoc | 1 + qutebrowser/mainwindow/mainwindow.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 6c40f68bb..920f20f66 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -156,6 +156,7 @@ Fixed - The tabbar now displays correctly with the Adwaita Qt theme - The default `sk` keybinding now sets the commandline to `:bind` correctly - Fixed hang when using multiple spaces in a row with the URL completion +- Fixed crash when closing a window without focusing it v0.8.3 (unreleased) ------------------- diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index e80187018..1acd33d14 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -492,12 +492,12 @@ class MainWindow(QWidget): def _do_close(self): """Helper function for closeEvent.""" - last_visible = objreg.get('last-visible-main-window') - if self is last_visible: - try: + try: + last_visible = objreg.get('last-visible-main-window') + if self is last_visible: objreg.delete('last-visible-main-window') - except KeyError: - pass + except KeyError: + pass objreg.get('session-manager').save_last_window_session() self._save_geometry() log.destroy.debug("Closing window {}".format(self.win_id))