diff -r 3ffd885abe00 -r 880f1693299a src/Pure/System/swing_thread.scala --- a/src/Pure/System/swing_thread.scala Fri May 25 11:18:32 2012 +0200 +++ b/src/Pure/System/swing_thread.scala Fri May 25 13:19:10 2012 +0200 @@ -24,11 +24,12 @@ def now[A](body: => A): A = { - @volatile var result: Option[Exn.Result[A]] = None - if (SwingUtilities.isEventDispatchThread()) { result = Some(Exn.capture(body)) } - else - SwingUtilities.invokeAndWait(new Runnable { def run = { result = Some(Exn.capture(body)) } }) - Exn.release(result.get) + if (SwingUtilities.isEventDispatchThread()) body + else { + lazy val result = { assert(); Exn.capture(body) } + SwingUtilities.invokeAndWait(new Runnable { def run = result }) + Exn.release(result) + } } def future[A](body: => A): Future[A] =