Drop Thread.getName from use in computeID(thread) in TrapExit SecurityManager to fix #997.

This commit is contained in:
Mark Harrah 2013-11-27 08:53:52 -05:00
parent ad60e6c794
commit e16864f2e7
3 changed files with 11 additions and 1 deletions

View File

@ -73,7 +73,9 @@ object TrapExit
/** Computes an identifier for a Thread that has a high probability of being unique within a single JVM execution. */
private def computeID(t: Thread): ThreadID =
// can't use t.getId because when getAccess first sees a Thread, it hasn't been initialized yet
s"${hex(System.identityHashCode(t))}:${t.getName}"
// can't use t.getName because calling it on AWT thread in certain circumstances generates a segfault (#997):
// Apple AWT: +[ThreadUtilities getJNIEnvUncached] attempting to attach current thread after JNFObtainEnv() failed
s"${hex(System.identityHashCode(t))}"
/** Waits for the given `thread` to terminate. However, if the thread state is NEW, this method returns immediately. */
private def waitOnThread(thread: Thread, log: Logger)

View File

@ -0,0 +1,5 @@
object O {
def main(argv: Array[String]) {
new java.awt.Color(0,0,0)
}
}

View File

@ -0,0 +1,3 @@
# in #997, creating an instance of an AWT class triggers a segfault
# this verifies that is fixed
> run