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))