mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix possible race that leaks PowerShell object dispose in ForEach-Object -Parallel (#12227)
This commit is contained in:
@@ -867,7 +867,7 @@ namespace System.Management.Automation.PSTasks
|
||||
}
|
||||
|
||||
task.StateChanged -= HandleTaskStateChangedDelegate;
|
||||
if (!_stopping)
|
||||
if (!_stopping || stateInfo.State != PSInvocationState.Stopped)
|
||||
{
|
||||
// StopAll disposes tasks.
|
||||
task.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user