Do not remove autosave after successfully opening file.

If SolveSpace crashes after the open, or hangs and is forcibly
killed, data would be lost. (I lost my data.) Instead, remove
autosave only in two cases: right after a successful save, or right
after a save is declined. This should be completely safe.
pull/19/head
whitequark 2016-06-23 02:50:25 +00:00
parent 3a34f63415
commit 51f4f27b2b
2 changed files with 3 additions and 4 deletions

View File

@ -15,6 +15,8 @@ Other new features:
* OS X: support 3Dconnexion devices (SpaceMouse, SpaceNavigator, etc).
Bug fixes:
* Do not remove autosaves after successfully opening a file, preventing
data loss in case of two abnormal terminations in a row.
* Three.js: correctly respond to controls when browser zoom is used.
* OS X: do not completely hide main window when defocused.

View File

@ -134,7 +134,6 @@ bool SolveSpaceUI::OpenFile(const std::string &filename) {
saveFile = filename;
bool success = fileLoaded && ReloadAllImported(/*canCancel=*/true);
if(success) {
RemoveAutosave();
AddToRecentList(filename);
} else {
saveFile = "";
@ -220,9 +219,6 @@ void SolveSpaceUI::Exit() {
// And the default styles, colors and line widths and such.
Style::FreezeDefaultStyles();
// Exiting cleanly.
RemoveAutosave();
ExitNow();
}
@ -415,6 +411,7 @@ bool SolveSpaceUI::OkayToStartNewFile() {
return GetFilenameAndSave(/*saveAs=*/false);
case DIALOG_NO:
RemoveAutosave();
return true;
case DIALOG_CANCEL: