Commit c6cbc97a authored by Tobias Hunger's avatar Tobias Hunger
Browse files

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: default avatarOswald Buddenhagen <oswald.buddenhagen@digia.com>
parent 1d5eb681
...@@ -373,10 +373,12 @@ bool FileSaver::finalize() ...@@ -373,10 +373,12 @@ bool FileSaver::finalize()
return FileSaverBase::finalize(); return FileSaverBase::finalize();
SaveFile *sf = static_cast<SaveFile *>(m_file); SaveFile *sf = static_cast<SaveFile *>(m_file);
if (m_hasError) if (m_hasError) {
sf->rollback(); if (sf->isOpen())
else sf->rollback();
} else {
setResult(sf->commit()); setResult(sf->commit());
}
delete sf; delete sf;
m_file = 0; m_file = 0;
return !m_hasError; return !m_hasError;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment