clear Thread::javaThread before entering zombie state, since clearing it in Thread::dispose is too late - the reference may already be invalid since we don't visit GC roots for zombie threads

This commit is contained in:
Joel Dice 2009-08-20 08:49:01 -06:00
parent c4b5ecec90
commit 6196f61938
2 changed files with 4 additions and 2 deletions

View File

@ -53,6 +53,9 @@ DetachCurrentThread(Machine* m)
ACQUIRE_RAW(t, t->m->stateLock);
enter(t, Thread::ActiveState);
threadPeer(t, t->javaThread) = 0;
enter(t, Thread::ZombieState);
t->state = Thread::JoinedState;

View File

@ -2201,6 +2201,7 @@ Thread::exit()
if (m->liveCount == 1) {
turnOffTheLights(this);
} else {
threadPeer(this, javaThread) = 0;
enter(this, Thread::ZombieState);
}
}
@ -2209,8 +2210,6 @@ Thread::exit()
void
Thread::dispose()
{
threadPeer(this, javaThread) = 0;
if (systemThread) {
systemThread->dispose();
}