Update an incorrect abort message that claimed that thread A
was using the JNIEnv from thread A (when the JNIEnv was in
fact from another thread). Now, the message is e.g.
JNI DETECTED ERROR IN APPLICATION: thread
Thread[1,tid=628,Native,Thread*=0xb038b400,peer=0x75efc1f0,"main"]
using JNIEnv* from thread
Thread[6,tid=640,Runnable,Thread*=0xaa890800,peer=0x12c00ca0,"Binder:628_1"]
Change-Id: I877a78c47e88d1e8a28bade8ea40be6bed58439f
return false;
}
- // Get the *correct* JNIEnv by going through our TLS pointer.
+ // Get the current thread's JNIEnv by going through our TLS pointer.
JNIEnvExt* threadEnv = self->GetJniEnv();
// Verify that the current thread is (a) attached and (b) associated with
// this particular instance of JNIEnv.
if (env != threadEnv) {
+ // Get the thread owning the JNIEnv that's being used.
+ Thread* envThread = reinterpret_cast<JNIEnvExt*>(env)->self;
AbortF("thread %s using JNIEnv* from thread %s",
- ToStr<Thread>(*self).c_str(), ToStr<Thread>(*self).c_str());
+ ToStr<Thread>(*self).c_str(), ToStr<Thread>(*envThread).c_str());
return false;
}