Skip to content

Commit

Permalink
Prevent the GC task callback from segfaulting. (#32088)
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 25c33e4)
  • Loading branch information
rbehrends authored and KristofferC committed May 22, 2019
1 parent b19fcbc commit 1b72e97
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1b72e97

Please sign in to comment.