From 3f20f153c56312fc30cea702fe0620a95695e89f Mon Sep 17 00:00:00 2001 From: Lars <134181853+bo2themax@users.noreply.github.com> Date: Fri, 7 Nov 2025 15:19:13 +0100 Subject: [PATCH] macOS: fix undo new tab will cause a crash --- .../Features/Terminal/TerminalController.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 08bdac2ad..844808e97 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -377,9 +377,14 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr withTarget: controller, expiresAfter: controller.undoExpiration ) { target in - // Close the tab when undoing - undoManager.disableUndoRegistration { - target.closeTab(nil) + // Close the tab when undoing. We do this in a DispatchQueue because + // for some people on macOS Tahoe this caused a crash and the queue + // fixes it. + // https://github.com/ghostty-org/ghostty/pull/9512 + DispatchQueue.main.async { + undoManager.disableUndoRegistration { + target.closeTab(nil) + } } // Register redo action