[Scummvm-git-logs] scummvm master -> 73bb1e548b5120d178f7ecb581664aab46ebf49d
dreammaster
dreammaster at scummvm.org
Wed Jun 30 03:39:43 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
73bb1e548b ENGINES: Ensure there is no recursive call to auto-save
Commit: 73bb1e548b5120d178f7ecb581664aab46ebf49d
https://github.com/scummvm/scummvm/commit/73bb1e548b5120d178f7ecb581664aab46ebf49d
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-06-29T20:39:39-07:00
Commit Message:
ENGINES: Ensure there is no recursive call to auto-save
Changed paths:
engines/engine.cpp
diff --git a/engines/engine.cpp b/engines/engine.cpp
index 06991c1c25..f62001f133 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -530,6 +530,11 @@ void Engine::handleAutoSave() {
}
void Engine::saveAutosaveIfEnabled() {
+ // Reset the last autosave time first.
+ // Doing it here rather than after saving the game prevents recursive calls if saving the game
+ // causes the engine to poll events (as is the case with the AGS engine for example).
+ _lastAutosaveTime = _system->getMillis();
+
if (_autosaveInterval != 0) {
bool saveFlag = canSaveAutosaveCurrently();
@@ -549,13 +554,9 @@ void Engine::saveAutosaveIfEnabled() {
if (!saveFlag) {
// Set the next autosave interval to be in 5 minutes, rather than whatever
// full autosave interval the user has selected
- _lastAutosaveTime = _system->getMillis() + (5 * 60 * 1000) - _autosaveInterval;
- return;
+ _lastAutosaveTime += (5 * 60 * 1000) - _autosaveInterval;
}
}
-
- // Reset the last autosave time
- _lastAutosaveTime = _system->getMillis();
}
void Engine::errorString(const char *buf1, char *buf2, int size) {
More information about the Scummvm-git-logs
mailing list