From 69ce9a942ce4343f357304eac623923bda3278d2 Mon Sep 17 00:00:00 2001 From: Patric Schmitz Date: Tue, 28 Jun 2016 00:58:56 +0200 Subject: [PATCH] move savefile flush into try: block it seems flush might throw which will not be caught inside the (try-) else branch. (hopefully) fixes config corruption when no space available. --- qutebrowser/utils/qtutils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qutebrowser/utils/qtutils.py b/qutebrowser/utils/qtutils.py index 4da9d48af..4fe9ade0b 100644 --- a/qutebrowser/utils/qtutils.py +++ b/qutebrowser/utils/qtutils.py @@ -207,12 +207,11 @@ def savefile_open(filename, binary=False, encoding='utf-8'): else: new_f = io.TextIOWrapper(PyQIODevice(f), encoding=encoding) yield new_f + new_f.flush() except: f.cancelWriting() cancelled = True raise - else: - new_f.flush() finally: commit_ok = f.commit() if not commit_ok and not cancelled: