From 0cf15d36d9e6f5a40a16e17f3bd3d53682fe648c Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 26 Apr 2017 18:25:59 -0400 Subject: revamp 'exit immediately' to abort ongoing SMAPI tasks --- src/StardewModdingAPI/Framework/SGame.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/StardewModdingAPI/Framework/SGame.cs') diff --git a/src/StardewModdingAPI/Framework/SGame.cs b/src/StardewModdingAPI/Framework/SGame.cs index 61493e87..e7c07889 100644 --- a/src/StardewModdingAPI/Framework/SGame.cs +++ b/src/StardewModdingAPI/Framework/SGame.cs @@ -200,6 +200,13 @@ namespace StardewModdingAPI.Framework /// A snapshot of the game timing state. protected override void Update(GameTime gameTime) { + // SMAPI exiting, stop processing game updates + if (this.Monitor.IsExiting) + { + this.Monitor.Log("SMAPI shutting down: aborting update.", LogLevel.Trace); + return; + } + // While a background new-day task is in progress, the game skips its own update logic // and defers to the XNA Update method. Running mod code in parallel to the background // update is risky, because data changes can conflict (e.g. collection changed during -- cgit