From eb4213227d6527c0145f9ba3bc011be60fddf311 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 28 Nov 2026 22:41:07 +0800 Subject: [PATCH] fix(focus): avoid Swift IRGen outlined-destroy mismatch on FocusStore.Entry.Target --- Sources/OpenSwiftUI/Event/Focus/FocusStore.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/OpenSwiftUI/Event/Focus/FocusStore.swift b/Sources/OpenSwiftUI/Event/Focus/FocusStore.swift index 234ad289a..5a42ed749 100644 --- a/Sources/OpenSwiftUI/Event/Focus/FocusStore.swift +++ b/Sources/OpenSwiftUI/Event/Focus/FocusStore.swift @@ -185,7 +185,13 @@ extension FocusStore { var focusScopes: [Namespace.ID] private var target: Target - private enum Target { + // FIXME: Restore `private` once we adopt a Swift 6.5+ toolchain. + // A Swift IRGen bug (fixed in swiftlang/swift#90634, Swift 6.5) emits + // mismatched `linkonce_odr` outlined value-witness signatures across + // files under incremental Debug builds when a generic struct contains + // a `private`/`fileprivate` nested type, causing memory corruption and + // random crashes at runtime. + /* private */ enum Target { case focusResponder(WeakBox, WeakBox) case searchField(Binding) }