hotspot/src/share/vm/runtime/thread.cpp
changeset 40377 b77bf599c11b
parent 40074 135bb8aa1e18
child 40655 9f644073d3a0
--- a/hotspot/src/share/vm/runtime/thread.cpp	Thu Aug 11 16:22:08 2016 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Fri Aug 12 00:19:44 2016 -0400
@@ -374,11 +374,14 @@
   delete handle_area();
   delete metadata_handles();
 
+  // SR_handler uses this as a termination indicator -
+  // needs to happen before os::free_thread()
+  delete _SR_lock;
+  _SR_lock = NULL;
+
   // osthread() can be NULL, if creation of thread failed.
   if (osthread() != NULL) os::free_thread(osthread());
 
-  delete _SR_lock;
-
   // clear Thread::current if thread is deleting itself.
   // Needed to ensure JNI correctly detects non-attached threads.
   if (this == Thread::current()) {