From da8b171265e0f9db09287e62e70e10afa0d44e9c Mon Sep 17 00:00:00 2001 From: Lukas <134181853+bo2themax@users.noreply.github.com> Date: Thu, 23 Jul 2026 22:13:51 +0200 Subject: [PATCH] macOS: fix Sendable warning for UnsafeMutablePointer Swift explicitly [marked UnsafeMutablePointer as non sendable](https://github.com/swiftlang/swift/commit/0568dbf903bbd7c1278c029d7e4eaaad6a460002). Moving from `@unchecked @retroactive` to `nonisolated(unsafe)` is safe for us as per the previous comments --- macos/Sources/Ghostty/Ghostty.Inspector.swift | 4 +++- macos/Sources/Ghostty/Ghostty.Surface.swift | 4 +++- macos/Sources/Ghostty/GhosttyPackage.swift | 7 ------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/macos/Sources/Ghostty/Ghostty.Inspector.swift b/macos/Sources/Ghostty/Ghostty.Inspector.swift index 79567bc4a..fc1983b8f 100644 --- a/macos/Sources/Ghostty/Ghostty.Inspector.swift +++ b/macos/Sources/Ghostty/Ghostty.Inspector.swift @@ -6,7 +6,9 @@ extension Ghostty { /// /// Wraps a `ghostty_inspector_t` final class Inspector: Sendable { - private let inspector: ghostty_inspector_t + /// A inspector is sendable because it is just a reference type. Using the inspector in parameters + /// may be unsafe but the value itself is safe to send across threads. + nonisolated(unsafe) private let inspector: ghostty_inspector_t /// Read the underlying C value for this inspector. This is unsafe because the value will be /// freed when the Inspector class is deinitialized. diff --git a/macos/Sources/Ghostty/Ghostty.Surface.swift b/macos/Sources/Ghostty/Ghostty.Surface.swift index 820441090..a076063d5 100644 --- a/macos/Sources/Ghostty/Ghostty.Surface.swift +++ b/macos/Sources/Ghostty/Ghostty.Surface.swift @@ -10,7 +10,9 @@ extension Ghostty { /// /// Wraps a `ghostty_surface_t` final class Surface: Sendable { - private let surface: ghostty_surface_t + /// A surface is sendable because it is just a reference type. Using the surface in parameters + /// may be unsafe but the value itself is safe to send across threads. + nonisolated(unsafe) private let surface: ghostty_surface_t /// Read the underlying C value for this surface. This is unsafe because the value will be /// freed when the Surface class is deinitialized. diff --git a/macos/Sources/Ghostty/GhosttyPackage.swift b/macos/Sources/Ghostty/GhosttyPackage.swift index 68c196dbc..313223aa3 100644 --- a/macos/Sources/Ghostty/GhosttyPackage.swift +++ b/macos/Sources/Ghostty/GhosttyPackage.swift @@ -4,13 +4,6 @@ import GhosttyKit // MARK: C Extensions -/// A command is fully self-contained so it is Sendable. -extension ghostty_command_s: @unchecked @retroactive Sendable {} - -/// A surface is sendable because it is just a reference type. Using the surface in parameters -/// may be unsafe but the value itself is safe to send across threads. -extension ghostty_surface_t: @unchecked @retroactive Sendable {} - extension Ghostty { // The user notification category identifier static let userNotificationCategory = "com.mitchellh.ghostty.userNotification"