From f1ffa821cec5fc38c8fe2d2a00b821baab33e655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Fri, 6 Jun 2025 13:47:07 +0200 Subject: [PATCH] modules: release all resources on ecl_halt Previously we were lazy and simply marked the runtime as "not booted", but now we do perform a proper shutdown. --- src/c/boot.d | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/c/boot.d b/src/c/boot.d index e27ffe046..2672233a4 100644 --- a/src/c/boot.d +++ b/src/c/boot.d @@ -260,20 +260,22 @@ ecl_boot(void) i = ecl_option_values[ECL_OPT_BOOTED]; if (i) { if (i < 0) { - /* We have called cl_shutdown and want to use ECL again. */ + /* The runtime has been only suspended. Resume it.*/ ecl_set_option(ECL_OPT_BOOTED, 1); } return 1; } init_modules(); ecl_core.path_max = MAXPATHLEN; - return 0; } int ecl_halt(void) { - ecl_set_option(ECL_OPT_BOOTED, -1); + int i = ecl_option_values[ECL_OPT_BOOTED]; + if (i > 0) + free_modules(); + ecl_set_option(ECL_OPT_BOOTED, 0); return 0; }