]> git.lyx.org Git - lyx.git/commitdiff
Don't guess whether autosave succeeded
authorGeorg Baum <baum@lyx.org>
Fri, 4 Jul 2014 19:06:49 +0000 (21:06 +0200)
committerGeorg Baum <baum@lyx.org>
Fri, 4 Jul 2014 19:06:49 +0000 (21:06 +0200)
writeFile() tells whether it could save the file, so use the return value
instead of guessing.

src/Buffer.cpp

index 10e7a277fd08f165c3b50fbe7af4f7213bbed444..4331309857d5420088394f9c0c9389fac1549c9e 100644 (file)
@@ -3738,9 +3738,9 @@ int AutoSaveBuffer::generateChild()
        tempfile.setAutoRemove(false);
        FileName const tmp_ret = tempfile.name();
        if (!tmp_ret.empty()) {
-               buffer_.writeFile(tmp_ret);
-               // assume successful write of tmp_ret
-               if (!tmp_ret.moveTo(fname_))
+               if (!buffer_.writeFile(tmp_ret))
+                       failed = true;
+               else if (!tmp_ret.moveTo(fname_))
                        failed = true;
        } else
                failed = true;