macos: ensure all surfaces are closed when a window is closed

This commit is contained in:
Gregory Anders
2023-11-18 08:40:40 -06:00
parent 080789957a
commit be7be538af

View File

@ -19,9 +19,12 @@ class TerminalController: NSWindowController, NSWindowDelegate,
/// The surface tree for this window.
@Published var surfaceTree: Ghostty.SplitNode? = nil {
didSet {
// If our surface tree becomes nil then it means all our surfaces
// have closed, so we also close the window.
if (surfaceTree == nil) { lastSurfaceDidClose() }
// If our surface tree becomes nil then ensure all surfaces
// in the old tree have closed and then close the window.
if (surfaceTree == nil) {
oldValue?.close()
lastSurfaceDidClose()
}
}
}