Skip to content

Commit b7de390

Browse files
xperiandriclaude
andcommitted
Open a new window after the old one is closed
Closing disposed the evaluator but kept the window and evaluator fields, so the next open submitted through the disposed host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9b38dbb commit b7de390

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎vsintegration/src/FSharp.Interactive.Window/FSharpVsInteractiveWindowProvider.fs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,16 @@ type internal FSharpVsInteractiveWindowProvider
108108
)
109109

110110
let interactiveWindow = toolWindow.InteractiveWindow
111-
interactiveWindow.TextView.Closed.Add(fun _ -> (created :> IDisposable).Dispose())
111+
interactiveWindow.TextView.Closed.Add(fun _ ->
112+
(created :> IDisposable).Dispose()
113+
114+
// Only this window's own fields: a close arriving late must not forget a newer window.
115+
if obj.ReferenceEquals(window, toolWindow) then
116+
window <- null
117+
118+
match evaluator with
119+
| ValueSome current when obj.ReferenceEquals(current, created) -> evaluator <- ValueNone
120+
| _ -> ())
112121
interactiveWindow.InitializeAsync() |> ignore
113122
toolWindow
114123

0 commit comments

Comments
 (0)