diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-15 19:14:40 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-15 19:14:40 -0400 |
commit | 5731b015a0c548ac72e0d7ce9c4153aa52da3562 (patch) | |
tree | a5897fa7258d4fc9cd79d7a975ce9d3d936b8cc4 /src/SMAPI/Framework/Events/ManagedEvent.cs | |
parent | a9cadc7f32fd9fd244fc3e22c62a35e7c257c084 (diff) | |
parent | cd843dc10b902adc32e96e34c5db3ebf98e9a159 (diff) | |
download | SMAPI-5731b015a0c548ac72e0d7ce9c4153aa52da3562.tar.gz SMAPI-5731b015a0c548ac72e0d7ce9c4153aa52da3562.tar.bz2 SMAPI-5731b015a0c548ac72e0d7ce9c4153aa52da3562.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/Events/ManagedEvent.cs')
-rw-r--r-- | src/SMAPI/Framework/Events/ManagedEvent.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/Events/ManagedEvent.cs b/src/SMAPI/Framework/Events/ManagedEvent.cs index 8a3ca839..a72d8d04 100644 --- a/src/SMAPI/Framework/Events/ManagedEvent.cs +++ b/src/SMAPI/Framework/Events/ManagedEvent.cs @@ -104,6 +104,8 @@ namespace StardewModdingAPI.Framework.Events // raise event foreach (ManagedEventHandler<TEventArgs> handler in this.GetHandlers()) { + Context.HeuristicModsRunningCode.Push(handler.SourceMod); + try { handler.Handler(null, args); @@ -112,6 +114,10 @@ namespace StardewModdingAPI.Framework.Events { this.LogError(handler, ex); } + finally + { + Context.HeuristicModsRunningCode.TryPop(out _); + } } } @@ -126,6 +132,8 @@ namespace StardewModdingAPI.Framework.Events // raise event foreach (ManagedEventHandler<TEventArgs> handler in this.GetHandlers()) { + Context.HeuristicModsRunningCode.Push(handler.SourceMod); + try { invoke(handler.SourceMod, args => handler.Handler(null, args)); @@ -134,6 +142,10 @@ namespace StardewModdingAPI.Framework.Events { this.LogError(handler, ex); } + finally + { + Context.HeuristicModsRunningCode.TryPop(out _); + } } } |