Merge pull request #908 from gpanders/surface-close

macos: ensure all surfaces are closed when a window is closed
This commit is contained in:
Mitchell Hashimoto
2023-11-18 08:32:13 -08:00
committed by GitHub

View File

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