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.
This commit is contained in:
Patric Schmitz 2016-06-28 00:58:56 +02:00
parent 72e5bf35e1
commit 69ce9a942c

View File

@ -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: