From 6b7532ae4231e25ca1a8b8d5bcb3ee0b7f29539e Mon Sep 17 00:00:00 2001 From: Timo Paulssen Date: Sun, 18 Feb 2018 17:28:08 +0100 Subject: [PATCH] account for thread_join deleting tc from threads --- src/profiler/instrument.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/profiler/instrument.c b/src/profiler/instrument.c index 4a6629aa29..f6bb4b70fd 100644 --- a/src/profiler/instrument.c +++ b/src/profiler/instrument.c @@ -573,7 +573,9 @@ void MVM_profile_dump_instrumented_data(MVMThreadContext *tc) { while (thread) { MVMThreadContext *othertc = thread->body.tc; - if (othertc->prof_data) { + /* Check for othertc to exist because joining threads nulls out + * the tc entry in the thread object. */ + if (othertc && othertc->prof_data && othertc != tc) { /* If we have any call frames still on the profile stack, exit them. */ while (othertc->prof_data->current_call) MVM_profile_log_exit(othertc);