From 8242eab297e0b9bc6ba4f3c218d829b3df60ee40 Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Fri, 10 Apr 2020 18:02:42 -0700 Subject: [PATCH] Don't call exit() with threads running Otherwise running threads race with destructors. Bug: 150176543 Test: Build and boot AOSP Change-Id: I159164a36d9808ae86c2928271b14736178e127b (cherry picked from commit 0fcf4a605daa4f7cd43eddbf25cfe22d4e2bc391) --- core/jni/AndroidRuntime.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index ba7aef7c208e6..b51d4f509f384 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -1244,12 +1244,11 @@ void AndroidRuntime::exit(int code) { if (mExitWithoutCleanup) { ALOGI("VM exiting with result code %d, cleanup skipped.", code); - ::_exit(code); } else { ALOGI("VM exiting with result code %d.", code); onExit(code); - ::exit(code); } + ::_exit(code); } void AndroidRuntime::onVmCreated(JNIEnv* env)