Skip to content

Commit 97a9880

Browse files
committed
Always dispose processes on FindExecutableProcess finalizer
1 parent 37e0a69 commit 97a9880

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Hi3Helper.Plugin.HBR/Exports.GameLaunch.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,17 @@ public override bool KillRunningGameCore(GameManagerExtension.RunGameFromGameMan
111111
}
112112
}
113113

114-
if (returnProcess == null)
114+
try
115115
{
116-
return null;
116+
return returnProcess;
117117
}
118-
119-
foreach (var process in processes.Where(x => x != returnProcess))
118+
finally
120119
{
121-
process.Dispose();
120+
foreach (var process in processes.Where(x => x != returnProcess))
121+
{
122+
process.Dispose();
123+
}
122124
}
123-
124-
return returnProcess;
125125
}
126126

127127
private static bool TryGetGameExecutablePath(GameManagerExtension.RunGameFromGameManagerContext context, [NotNullWhen(true)] out string? gameExecutablePath)

0 commit comments

Comments
 (0)