From e9961ad89a2eebaa3dda8d70126c7c8b683ddeaa Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 31 Mar 2024 22:05:07 +0200 Subject: [PATCH] OS: Add exception for pm to hold dangling process handles --- source/os.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/os.cpp b/source/os.cpp index fef2c9c..2f702b9 100644 --- a/source/os.cpp +++ b/source/os.cpp @@ -5888,7 +5888,10 @@ try{ if (terminate_process) { for (auto& other_process : process_handles) { for (auto& handle : other_process.second->handle_table.table) { - if (handle.second == parent_process && handle.first != Handle { 0xFFFF8001 }) { + // The pm module holds references to every other process. + // If any other modules still reference the process, then + // that indicates a handle leak. + if (handle.second == parent_process && handle.first != Handle { 0xFFFF8001 } && other_process.second->GetName() != "pm") { fmt::print( "Process {} still holds a reference to {} through its handle {}\n", other_process.second->GetName(), parent_process->GetName(), HandlePrinter { *thread, handle.first }); }