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.
This commit is contained in:
MarcelineVQ
2026-03-24 18:52:51 -07:00
parent 170f14a91a
commit 9a3e06a7cc
+3 -14
View File
@@ -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;
}