summaryrefslogtreecommitdiff
path: root/test/901-hello-ti-agent/basics.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/901-hello-ti-agent/basics.cc')
-rw-r--r--test/901-hello-ti-agent/basics.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/901-hello-ti-agent/basics.cc b/test/901-hello-ti-agent/basics.cc
index 472f2b768e..43a1d8319f 100644
--- a/test/901-hello-ti-agent/basics.cc
+++ b/test/901-hello-ti-agent/basics.cc
@@ -56,9 +56,13 @@ static void JNICALL VMInitCallback(jvmtiEnv *jvmti_env,
fsync(1);
}
-static void JNICALL VMDeatchCallback(jvmtiEnv *jenv, JNIEnv* jni_env ATTRIBUTE_UNUSED) {
+static void JNICALL VMDeathCallback(jvmtiEnv *jenv, JNIEnv* jni_env) {
printf("VMDeath (phase %d)\n", getPhase(jenv));
fsync(1);
+ jthread cur_thr;
+ CHECK_EQ(jenv->GetCurrentThread(&cur_thr), JVMTI_ERROR_NONE);
+ CHECK(cur_thr != nullptr);
+ jni_env->DeleteLocalRef(cur_thr);
}
@@ -67,7 +71,7 @@ static void InstallVMEvents(jvmtiEnv* env) {
memset(&callbacks, 0, sizeof(jvmtiEventCallbacks));
callbacks.VMStart = VMStartCallback;
callbacks.VMInit = VMInitCallback;
- callbacks.VMDeath = VMDeatchCallback;
+ callbacks.VMDeath = VMDeathCallback;
jvmtiError ret = env->SetEventCallbacks(&callbacks, sizeof(callbacks));
if (ret != JVMTI_ERROR_NONE) {
printf("Failed to install callbacks");