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
diff --git a/vm/alloc/HeapSource.c b/vm/alloc/HeapSource.c
index 62c0740..c86994f 100644
--- a/vm/alloc/HeapSource.c
+++ b/vm/alloc/HeapSource.c
@@ -450,7 +450,7 @@
static void gcDaemonShutdown(void)
{
- if (gDvm.concurrentMarkSweep) {
+ if (gHs->hasGcThread) {
dvmLockMutex(&gHs->gcThreadMutex);
gHs->gcThreadShutdown = true;
dvmSignalCond(&gHs->gcThreadCond);
@@ -588,7 +588,7 @@
void dvmHeapSourceThreadShutdown(void)
{
- if (gDvm.gcHeap != NULL) {
+ if (gDvm.gcHeap != NULL && gDvm.concurrentMarkSweep) {
gcDaemonShutdown();
}
}