From 55253039466a3b4c15dee9d4a94329c8e73772a3 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 23 Jun 2016 02:50:25 +0000 Subject: [PATCH] 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. --- CHANGELOG.md | 2 ++ src/solvespace.cpp | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73c7d25..23613a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,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. diff --git a/src/solvespace.cpp b/src/solvespace.cpp index b89044d..398cba0 100644 --- a/src/solvespace.cpp +++ b/src/solvespace.cpp @@ -132,7 +132,6 @@ bool SolveSpaceUI::OpenFile(const std::string &filename) { saveFile = filename; bool success = fileLoaded && ReloadAllImported(/*canCancel=*/true); if(success) { - RemoveAutosave(); AddToRecentList(filename); } else { saveFile = ""; @@ -218,9 +217,6 @@ void SolveSpaceUI::Exit(void) { // And the default styles, colors and line widths and such. Style::FreezeDefaultStyles(); - // Exiting cleanly. - RemoveAutosave(); - ExitNow(); } @@ -415,6 +411,7 @@ bool SolveSpaceUI::OkayToStartNewFile(void) { return GetFilenameAndSave(false); case DIALOG_NO: + RemoveAutosave(); return true; case DIALOG_CANCEL: