From 650cd966461ed38bb2ab347203af71e78c7b336b Mon Sep 17 00:00:00 2001 From: Lukas <134181853+bo2themax@users.noreply.github.com> Date: Sat, 11 Apr 2026 21:20:16 +0200 Subject: [PATCH] macOS: fix memory leak of TerminalController Regression of #12119, this memory leak affects new tabs, since the terminal controller is not deallocated correctly. Hitting `cmd+t` will create a new window with two tabs, but only one actually contains usable surface. You can reproduce by: 1. Quit and Reopen Ghostty 2. Open a new window if no window is created (initial-window = false) 3. Close the window 4. Hit `cmd+t` --- macos/Sources/Features/Terminal/TerminalController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 9866e0deb..7e9b91b19 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -157,7 +157,7 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr scheduledWorkItem = DispatchWorkItem { [weak self] in guard let self else { return } defer { self.pendingInitialPresentation = nil } - guard scheduledWorkItem?.isCancelled == false else { return } + guard pendingInitialPresentation?.isCancelled == false else { return } block() }