From fe6087708cdeafecf223dd1d2d5e6606db70a4e1 Mon Sep 17 00:00:00 2001 From: Carl Shapiro Date: Wed, 28 Jul 2010 19:33:46 -0700 Subject: [PATCH] Fix a crash during VM shutdown. The code to shutdown the GC daemon thread was not checking to see if the GC daemon thread had been initialized. This caused pthread_join to crash waiting for an uninitialized thread object. Change-Id: Iac338a054775aa024d74fbb4a5de35e12d95b862 --- vm/alloc/HeapSource.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vm/alloc/HeapSource.c b/vm/alloc/HeapSource.c index 62c0740eb..c86994f36 100644 --- a/vm/alloc/HeapSource.c +++ b/vm/alloc/HeapSource.c @@ -450,7 +450,7 @@ static bool gcDaemonStartup(void) static void gcDaemonShutdown(void) { - if (gDvm.concurrentMarkSweep) { + if (gHs->hasGcThread) { dvmLockMutex(&gHs->gcThreadMutex); gHs->gcThreadShutdown = true; dvmSignalCond(&gHs->gcThreadCond); @@ -588,7 +588,7 @@ dvmHeapSourceStartupBeforeFork() void dvmHeapSourceThreadShutdown(void) { - if (gDvm.gcHeap != NULL) { + if (gDvm.gcHeap != NULL && gDvm.concurrentMarkSweep) { gcDaemonShutdown(); } } -- 2.11.0