FileSaver: Do not rollback if we never opened the file

This will silence some warnings about removing files with empty
filenames which we get due to trying to remove a file we never
managed to open.

Calling finalize() unconditionally is the right thing to do here
as that processes and/or displays on error message to the user
if there is any.

Change-Id: Ibe7d07233f2c2698e53a7ad21041bc5cc4fcac0e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Tobias Hunger
2013-06-04 18:00:42 +02:00
parent 1d5eb6812a
commit c6cbc97a5c

View File

@@ -373,10 +373,12 @@ bool FileSaver::finalize()
return FileSaverBase::finalize();
SaveFile *sf = static_cast<SaveFile *>(m_file);
if (m_hasError)
sf->rollback();
else
if (m_hasError) {
if (sf->isOpen())
sf->rollback();
} else {
setResult(sf->commit());
}
delete sf;
m_file = 0;
return !m_hasError;