From 74e3df31b05545e6df2c824fbedefeeea5d169c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Sun, 25 May 2014 13:33:37 +0200 Subject: [PATCH] Cleanup: Delay free of the destroy_called_mark_hash. Freeing of the destroy_called_mark_hash needs to be delayed until after the last gc() call. Fixes SEGV on exit if the gc on exit needs to destruct something with an lfun::destroy(). --- src/module.c | 2 ++ src/object.c | 3 +++ src/object.h | 1 + 3 files changed, 6 insertions(+) diff --git a/src/module.c b/src/module.c index 25bfdf5340..d5f3a0dc3e 100644 --- a/src/module.c +++ b/src/module.c @@ -348,6 +348,8 @@ static void exit_builtin_modules(void) really_clean_up_interpret(); + late_exit_object(); + cleanup_callbacks(); free_all_callable_blocks(); diff --git a/src/object.c b/src/object.c index 7afbc3aaed..b9486033e4 100644 --- a/src/object.c +++ b/src/object.c @@ -3279,7 +3279,10 @@ void exit_object(void) free_program(magic_types_program); magic_types_program=0; } +} +void late_exit_object(void) +{ exit_destroy_called_mark_hash(); } diff --git a/src/object.h b/src/object.h index 83108e2d26..d75d636bd9 100644 --- a/src/object.h +++ b/src/object.h @@ -148,6 +148,7 @@ void push_magic_index(struct program *type, int inherit_no, int parent_level); void low_init_object(void); void init_object(void); void exit_object(void); +void late_exit_object(void); void check_object_context(struct object *o, struct program *context_prog, char *current_storage); -- GitLab