diff --git a/run/src/main/scala/sbt/TrapExit.scala b/run/src/main/scala/sbt/TrapExit.scala index ce761b002..def4caebc 100644 --- a/run/src/main/scala/sbt/TrapExit.scala +++ b/run/src/main/scala/sbt/TrapExit.scala @@ -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) diff --git a/sbt/src/sbt-test/run/awt/A.scala b/sbt/src/sbt-test/run/awt/A.scala new file mode 100644 index 000000000..d7eba868b --- /dev/null +++ b/sbt/src/sbt-test/run/awt/A.scala @@ -0,0 +1,5 @@ +object O { + def main(argv: Array[String]) { + new java.awt.Color(0,0,0) + } +} diff --git a/sbt/src/sbt-test/run/awt/test b/sbt/src/sbt-test/run/awt/test new file mode 100644 index 000000000..540d707bb --- /dev/null +++ b/sbt/src/sbt-test/run/awt/test @@ -0,0 +1,3 @@ +# in #997, creating an instance of an AWT class triggers a segfault +# this verifies that is fixed +> run