From 7ec65f174df8a746512cc2fb664e2d8ec0fd0cdc Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Mon, 29 Oct 2018 14:09:34 -0700 Subject: [PATCH] Close the current global file tree view on unload I noticed that when using the latest nightly, triggered execution would fail to work if I switched projects with, e.g. ++2.10.7. This was because the background thread that filled the file cache was incorrectly shutdown. To fix this, we just need to close whatever view is cached in the globalFileTreeView attribute in the exit hook rather than the view created by the method. After making this change and publishing a local SNAPSHOT build, I was able to switch projects with ++ and have triggeredExecution continue to work. --- main/src/main/scala/sbt/Main.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/src/main/scala/sbt/Main.scala b/main/src/main/scala/sbt/Main.scala index 358ee2c62..03dd44844 100644 --- a/main/src/main/scala/sbt/Main.scala +++ b/main/src/main/scala/sbt/Main.scala @@ -883,7 +883,7 @@ object BuiltinCommands { val (_, config: FileTreeViewConfig) = extracted.runTask(Keys.fileTreeViewConfig, s) val view: FileTreeDataView[StampedFile] = config.newDataView() val newState = s.addExitHook { - view.close() + s.get(BasicKeys.globalFileTreeView).foreach(_.close()) s.attributes.remove(BasicKeys.globalFileTreeView) () }