From 2a3befd970028345d1e2d268a95de17900cc14d8 Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Sat, 29 Aug 2026 18:07:38 +0200 Subject: [PATCH] V34 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..3b204bb 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 => { + // Process-exit safety: when Windows is terminating the whole + // process, do not call heavy cleanup from DLL_PROCESS_DETACH. + // Resources are reclaimed by the OS. Explicit FreeLibrary still + // performs the normal uninstall path. + if (reserved == null) uninstall(); + }, else => {}, } return @enumFromInt(1);