From 9a3e06a7cc52fc5b15324dea200b6e7832f63c9a Mon Sep 17 00:00:00 2001 From: MarcelineVQ Date: Tue, 24 Mar 2026 18:52:51 -0700 Subject: [PATCH] core: disableAll only removes module hooks, core stays until DLL unload Core hooks (file serving, Lua registration, engine init/shutdown) are shared infrastructure that other loaded DLLs depend on. Only release them in uninstall (DLL_PROCESS_DETACH), never via the runtime API. --- src/main.zig | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/main.zig b/src/main.zig index 4b1e749..67b320b 100644 --- a/src/main.zig +++ b/src/main.zig @@ -812,6 +812,7 @@ fn uninstall() void { file_hook.detach(); removeFileHooks(); protection_hook.detach(); + g_core_owner = false; } mod_mutex.release(&g_core_mutex); logging.deinit(); @@ -867,12 +868,12 @@ fn disableModule(name: [*:0]const u8) callconv(.c) i32 { return 0; } -/// Disables all modules in reverse order, then detaches core hooks. +/// Disables all modules in reverse order. +/// Core hooks are left intact since other DLLs may depend on them. /// Returns the number of modules that were disabled. fn disableAll() callconv(.c) i32 { var count: i32 = 0; - // Remove modules in reverse order comptime var i = modules.len; inline while (i > 0) { i -= 1; @@ -883,18 +884,6 @@ fn disableAll() callconv(.c) i32 { } addons.pruneInactivePrefixes(); - if (g_core_owner) { - shutdown_hook.detach(); - logout_hook.detach(); - engine_init_hook.detach(); - addons.uninstall(); - register_commands_hook.detach(); - glue_commands_hook.detach(); - file_hook.detach(); - removeFileHooks(); - protection_hook.detach(); - } - return count; }