[dart:io, win] Don't delete the process list mutex during shutdown.

The exit callback might fire during or after dart:io shutdown.

TEST=ci (flaky)
Bug: https://github.com/dart-lang/sdk/issues/60499
Change-Id: I950ef4a6ba1d99a8eafb55cb051a60f0cb097e71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493485
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2026-04-08 08:33:32 -07:00
committed by Commit Queue
parent 5789ef3f58
commit 1dc1b015eb
+8 -7
View File
@@ -159,7 +159,9 @@ class ProcessInfoList {
HANDLE exit_pipe;
bool success = LookupProcess(pid, &handle, &wait_handle, &exit_pipe);
if (!success) {
FATAL("Failed to lookup process in list of active processes");
// Failed to lookup process in list of active processes. This might happen
// if a child exits after dart:io shutdown.
return;
}
// Unregister the event in a non-blocking way.
BOOL ok = UnregisterWait(wait_handle);
@@ -1333,15 +1335,14 @@ void Process::ClearSignalHandlerByFd(intptr_t fd, Dart_Port port) {
}
void ProcessInfoList::Init() {
active_processes_ = nullptr;
ASSERT(ProcessInfoList::mutex_ == nullptr);
ProcessInfoList::mutex_ = new Mutex();
if (mutex_ == nullptr) {
mutex_ = new Mutex();
}
}
void ProcessInfoList::Cleanup() {
ASSERT(ProcessInfoList::mutex_ != nullptr);
delete ProcessInfoList::mutex_;
ProcessInfoList::mutex_ = nullptr;
// Do not delete mutex_. A child process might exit during/after dart:io
// shutdown.
}
void Process::Init() {