summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Events/ManagedEvent.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-15 19:14:40 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-15 19:14:40 -0400
commit5731b015a0c548ac72e0d7ce9c4153aa52da3562 (patch)
treea5897fa7258d4fc9cd79d7a975ce9d3d936b8cc4 /src/SMAPI/Framework/Events/ManagedEvent.cs
parenta9cadc7f32fd9fd244fc3e22c62a35e7c257c084 (diff)
parentcd843dc10b902adc32e96e34c5db3ebf98e9a159 (diff)
downloadSMAPI-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.cs12
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 _);
+ }
}
}