1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-04 11:10:27 +02:00

Fix a bug in after-gc Scheme hook

* libguile/gc.c (scm_gc_event_listener_restarting_mutators): Avoid
running hook before Guile is booted.
This commit is contained in:
Andy Wingo 2025-05-22 16:24:16 +02:00
parent 7b4f4427f8
commit 0a6767b3b9

View file

@ -41,6 +41,7 @@
#include "gsubr.h"
#include "hashtab.h"
#include "hooks.h"
#include "init.h"
#include "list.h"
#include "modules.h"
#include "numbers.h"
@ -194,7 +195,8 @@ scm_gc_event_listener_restarting_mutators (void *data)
/* If there are Scheme hooks and we have a current Guile thread,
enqueue those to be run on the current thread. */
scm_thread *t = SCM_I_CURRENT_THREAD;
if (t && scm_is_false (SCM_CDR (after_gc_async_cell)) &&
if (t && scm_initialized_p &&
scm_is_false (SCM_CDR (after_gc_async_cell)) &&
scm_is_false (scm_hook_empty_p (scm_after_gc_hook)))
{
SCM_SETCDR (after_gc_async_cell, t->pending_asyncs);