From d6c53ed634885742ba1dde0387da83aabd8193fd Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Sat, 29 Aug 2026 11:46:58 +0200 Subject: [PATCH] V37.1 ExitFix: skip heavy cleanup during process termination --- src/main.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.zig b/src/main.zig index f126d22..5e455cd 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1048,11 +1048,17 @@ comptime { pub export fn DllMain( _: ?*anyopaque, reason: u32, - _: ?*anyopaque, + reserved: ?*anyopaque, ) callconv(WINAPI) std.os.windows.BOOL { switch (reason) { 1 => install(), - 0 => uninstall(), + 0 => { + // ExitFix: when lpReserved is non-null, Windows is terminating the + // whole process. Do not call into D3D9/COM or other DLLs from + // DLL_PROCESS_DETACH during global teardown; the OS will reclaim + // those resources. Keep full uninstall for explicit FreeLibrary. + if (reserved == null) uninstall(); + }, else => {}, } return @enumFromInt(1);