From 86c48f3ff67ba7202e4e054257860c58446df4f8 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 15 Feb 2011 08:47:48 -0700 Subject: [PATCH] handle null p->javaThread in addThread and removeThread These functions may be called when p->javaThread is null, in which case we must not try to set the threadPeer field. --- src/machine.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/machine.h b/src/machine.h index af79ca2372..2db27532e7 100644 --- a/src/machine.h +++ b/src/machine.h @@ -1973,7 +1973,9 @@ addThread(Thread* t, Thread* p) p->peer = p->parent->child; p->parent->child = p; - threadPeer(t, p->javaThread) = reinterpret_cast(p); + if (p->javaThread) { + threadPeer(t, p->javaThread) = reinterpret_cast(p); + } } inline void @@ -1989,7 +1991,9 @@ removeThread(Thread* t, Thread* p) p->parent->child = p->peer; - threadPeer(t, p->javaThread) = 0; + if (p->javaThread) { + threadPeer(t, p->javaThread) = 0; + } } inline Thread*