diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-06-04 16:21:25 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-06-05 09:50:03 +0200 |
commit | b42bb1808979c714fd80d4ecee0b8e497ea687a3 (patch) | |
tree | 09f9f13090bea991091e0828ba4b8c7f18f2b996 | |
parent | d70c0e344d420af1d8520b0a73109850f66c518c (diff) | |
download | scala-b42bb1808979c714fd80d4ecee0b8e497ea687a3.tar.gz scala-b42bb1808979c714fd80d4ecee0b8e497ea687a3.tar.bz2 scala-b42bb1808979c714fd80d4ecee0b8e497ea687a3.zip |
SI-7418 Avoid concurrent use of compiler in REPL startup
Enable the tab completer *after* we're finished binding
$intp and unleashing power mode on the asynchronous
REPL startup thread.
Tested manually:
- run qbin/scala
- Paste "".toUp
- Hit <TAB> like a maniac
Before this patch, the crash was reproducible almost every time.
Afterwards, not the once.
-rw-r--r-- | src/repl/scala/tools/nsc/interpreter/ILoop.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala index 9f841f2c44..8ec8b2ed5f 100644 --- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala @@ -642,10 +642,6 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) } private def loopPostInit() { - in match { - case x: JLineReader => x.consoleReader.postInit - case _ => - } // Bind intp somewhere out of the regular namespace where // we can get at it in generated code. intp.quietBind(NamedParam[IMain]("$intp", intp)(tagOfIMain, classTag[IMain])) @@ -661,6 +657,11 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) unleashAndSetPhase() asyncMessage(power.banner) } + // SI-7418 Now, and only now, can we enable TAB completion. + in match { + case x: JLineReader => x.consoleReader.postInit + case _ => + } } def process(settings: Settings): Boolean = savingContextLoader { this.settings = settings |