From 028ac0746af8df0b260da4cfd74eac77e2eb2abd Mon Sep 17 00:00:00 2001 From: Reimer Behrends Date: Mon, 20 May 2019 13:55:23 +0200 Subject: [PATCH] Prevent the GC task callback from segfaulting. It is possible when marking task objects in the GC for the associated jl_ptls_t reference to be NULL. To determine whether a task is a root task, we therefore also have to check if that reference is valid. --- src/gc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gc.c b/src/gc.c index 08a8771143536..a4e7e5b472359 100644 --- a/src/gc.c +++ b/src/gc.c @@ -2344,7 +2344,8 @@ mark: { if (gc_cblist_task_scanner) { export_gc_state(ptls, &sp); gc_invoke_callbacks(jl_gc_cb_task_scanner_t, - gc_cblist_task_scanner, (ta, ta == ptls2->root_task)); + gc_cblist_task_scanner, + (ta, ptls2 != NULL && ta == ptls2->root_task)); import_gc_state(ptls, &sp); } #ifdef COPY_STACKS