diff --git a/src/jnienv.cpp b/src/jnienv.cpp index 4fdb0cb618..5ae0dd7a7a 100644 --- a/src/jnienv.cpp +++ b/src/jnienv.cpp @@ -74,6 +74,11 @@ DetachCurrentThread(Machine* m) uint64_t destroyJavaVM(Thread* t, uintptr_t*) { + { ENTER(t, Thread::ActiveState); + + t->m->classpath->shutDown(t); + } + // wait for other non-daemon threads to exit { ACQUIRE(t, t->m->stateLock); while (t->m->liveCount - t->m->daemonCount > 1) { diff --git a/src/machine.cpp b/src/machine.cpp index 6fe35a5ab9..c0cdaaf925 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -3324,8 +3324,6 @@ shutDown(Thread* t) setRoot(t, Machine::ShutdownHooks, 0); - t->m->classpath->shutDown(t); - object h = hooks; PROTECT(t, h); for (; h; h = pairSecond(t, h)) {